/* Embedded San Francisco (SF Pro Display) */
@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Ultralight.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-UltralightItalic.woff2") format("woff2");
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Thin.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-ThinItalic.woff2") format("woff2");
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-LightItalic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-RegularItalic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-MediumItalic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-SemiboldItalic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Heavy.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-HeavyItalic.woff2") format("woff2");
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SF Pro Display";
  src: url("../fonts/SF-Pro-Display-BlackItalic.woff2") format("woff2");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

:root {
      
      --app-height: 100vh;
      --app-stable-height: 100vh;
                  --tg-bg: #141414;
      --tg-bg-elevated: #1d1d1d;
      --tg-bg-elevated-soft: #262626;
      --tg-accent: #248bfe;
      --tg-accent-soft: rgba(36, 139, 254, 0.16);
      --tg-accent-2: #9b6bff;
      --tg-text: #f2f3f5;
      --tg-text-mute: #949ba4;
      --tg-text-secondary: #b5bac1;
      --tg-border-subtle: rgba(255, 255, 255, 0.08);
      --tg-border: rgba(255, 255, 255, 0.12);
      --tg-green: #2AAE5D;
      --tg-red: #f23f42;
      --tg-yellow: #f0b232;
      --card-radius: 16px;
      --card-radius-lg: 20px;
      --transition-fast: 260ms ease-out;
      --stack-gap: 8px;

      /* Typography (chosen to look crisp across iOS/Android/desktop WebViews) */
      --font-sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;
    }

    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html,
    html, body {
      width: 100%;
      height: 100%;
      overflow: hidden;
    }

    body {
      margin: 0;
    }


    body {
      height: 100%;
      font-family: var(--font-sans);
      font-size: 16px;
      line-height: 1.4;
      font-synthesis: none;
      text-rendering: optimizeLegibility;
      
      -webkit-text-size-adjust: 100%;
      text-size-adjust: 100%;
      
      touch-action: manipulation;
      background: var(--tg-bg);
      color: var(--tg-text);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow: hidden;
    }

    
    /*
  IMPORTANT:
  Telegram WebView (iOS/Android/Desktop) can change the *visible* viewport height
  while the user scrolls (top/bottom bars show/hide) or when moving the window
  between monitors / DPI scales.
  If we lock the root shell to viewportStableHeight only, the extra revealed area
  becomes an "unpainted" black gap. So: use the dynamic viewport height for sizing,
  and keep stable height only as a minimum to avoid jumps.
*/
html {
  height: var(--tg-viewport-height, var(--app-height, 100vh));
  min-height: var(--tg-viewport-stable-height, var(--tg-viewport-height, var(--app-height, 100vh)));
}

.tg-only-overlay {
      min-height: var(--tg-viewport-height, 100vh);
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--tg-bg);
      color: var(--tg-text);
      padding: 24px;
      text-align: center;
    }

    .tg-only-message {
      max-width: 360px;
      font-size: 16px;
      line-height: 1.5;
    }

    body {
      display: flex;
      align-items: flex-start;
      justify-content: center;
      padding: 0;
      height: var(--tg-viewport-height, var(--app-height, 100vh));
      min-height: var(--tg-viewport-stable-height, var(--tg-viewport-height, var(--app-height, 100vh)));
      
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      -khtml-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }

    .app-shell {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: var(--tg-viewport-height, var(--app-height, 100vh));
  min-height: var(--tg-viewport-stable-height, var(--tg-viewport-height, var(--app-height, 100vh)));

  padding-top: 0px;
  padding-bottom: 0px;
  box-sizing: border-box;

  width: 100%;
  max-width: 100%;
  min-width: 320px;
  background: var(--tg-bg);
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Keep the app in normal flow inside the fixed shell. */


    .app {
      position: relative;
      z-index: 1;
      display: flex;
      flex-direction: column;
      height: 100%;
      /* Safari/iOS: allow the scrollable child to shrink correctly inside flex container */
      min-height: 0;
    }

    
    main {
      flex: 1;
      padding: 2px 12px calc(16px + 0px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior-y: none;
      scrollbar-width: none;
      position: relative;
      background: var(--tg-bg);
      touch-action: pan-y;
      contain: none;
      scroll-behavior: auto;
      /* Safari/iOS: prevent scroll-area clipping inside flex layouts */
      min-height: 0;
    }

    main::-webkit-scrollbar {
      display: none;
    }

    main[aria-busy="true"] {
      opacity: 1;
    }
    
    .ptr-indicator {
      position: absolute;
      left: 0;
      right: 0;
      top: 0px;
      z-index: 1500;
      display: flex;
      justify-content: center;
      pointer-events: none;
      --ptr-offset: 0px;
    }

    .ptr-pill {
      display: inline-flex;
      align-items: center;
      gap: 0;
      padding: 0;
      border-radius: 999px;
      
      background: transparent;
      border: none;
      box-shadow: none;
      transform: translateY(calc(-56px + var(--ptr-offset)));
      opacity: 0;
      transition: opacity 160ms ease-out;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    .ptr-indicator.active .ptr-pill {
      opacity: 1;
    }

    .ptr-text {
      display: none; 
    }

    .ptr-icon {
      width: 24px;
      height: 24px;
      border-radius: 999px;
      border: 3px solid rgba(255, 255, 255, 0.18);
      border-top-color: rgba(255, 255, 255, 0.7);
      transform: rotate(0deg);
    }

    .ptr-indicator.ready .ptr-text {
      color: var(--tg-text);
    }

    .ptr-indicator.ready .ptr-icon {
      border-top-color: rgba(255, 255, 255, 0.9);
    }

    .ptr-indicator.refreshing .ptr-icon {
      animation: ptrSpin 0.9s linear infinite;
      border-top-color: rgba(255, 255, 255, 0.9);
    }

    @keyframes ptrSpin {
      to { transform: rotate(360deg); }
    }


    
    .top-promo-banner {
      position: relative;
      width: 100%;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      justify-content: center;
      margin-top: 4px;
      margin-bottom: 8px;
      border-radius: 18px;
      overflow: hidden;
      color: #fff;
      text-decoration: none;
      cursor: pointer;
      
      touch-action: manipulation;
    }


    .top-promo-slider {
      display: flex;
      width: 100%;
      
      transition: transform 950ms cubic-bezier(0.22, 0.61, 0.36, 1);
    }

    .top-promo-slide {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      flex-shrink: 0;
      column-gap: 16px;
      padding: 12px 16px;
      border-radius: 0;
      background: var(--tg-bg-elevated-soft);
    }

    
    
    
    .top-promo-slide-primary {
      background: var(--tg-bg-elevated-soft);
    }

    .top-promo-slide-secondary {
      background: var(--tg-bg-elevated-soft);
    }

    .top-promo-slide-secondary .top-promo-sub-dot {
      background: rgba(42, 174, 93, 0.78);
    }


    .top-promo-indicators {
      display: flex;
      gap: 6px;
      position: absolute;
      left: 16px;
      bottom: 12px;
      z-index: 2;
      padding: 6px 8px;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.28);
}

    .top-promo-indicator {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.3);
      opacity: 0.6;
    }

    .top-promo-indicator--active {
      width: 14px;
      background: rgba(255, 255, 255, 0.9);
      opacity: 1;
    }

    
    .top-promo-indicators { display: none !important; }


    .top-promo-text {
      display: flex;
      flex-direction: column;
      gap: 4px;
      max-width: 70%;
    }

.top-promo-title {
      font-size: 18px;
      font-weight: 700;
      letter-spacing: 0.02em;
      text-shadow: none;
    }

    .top-promo-sub {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      align-self: flex-start;
      padding: 3px 10px 4px;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.35);
      font-size: 13px;
      font-weight: 500;
      white-space: nowrap;
      max-width: 100%;
      overflow: hidden;
    }

    .top-promo-sub-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.28);
      box-shadow: none;
    }

    .top-promo-sub-label {
      text-transform: none;
      letter-spacing: 0.06em;
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    
    .top-promo-gifts {
      position: relative;
      flex: 0 0 110px;
      height: 64px;
      display: block;
    }

    .top-promo-rocket,
    .top-promo-gift {
      position: absolute;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
    }

    .top-promo-rocket {
      width: 56px;
      height: 56px;
      left: 28px;
      top: 4px;
      background: radial-gradient(circle at 30% 20%, rgba(42, 174, 93, 0.38), rgba(34, 132, 73, 0.70) 52%, rgba(29, 29, 29, 1) 100%);
    }

    .top-promo-rocket svg {
      width: 26px;
      height: 26px;
      display: block;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    }

    .top-promo-gift {
      width: 32px;
      height: 32px;
      background: radial-gradient(circle at 30% 15%, rgba(42, 174, 93, 0.28), rgba(34, 132, 73, 0.62) 58%, rgba(29, 29, 29, 1) 100%);
    }

    .top-promo-gifts .top-promo-gift:first-child {
      left: -4px;
      top: 22px;
    }

    .top-promo-gifts .top-promo-gift:last-child {
      right: -4px;
      top: 10px;
    }

    .top-promo-gift svg {
      width: 16px;
      height: 16px;
      display: block;
      filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
    }

    @media (max-width: 480px) {
      .top-promo-title {
        font-size: 16px;
      }

      .top-promo-text {
        max-width: 68%;
      }

      .top-promo-gifts {
        flex: 0 0 96px;
        height: 56px;
      }

      .top-promo-rocket {
        width: 48px;
      height: 44px;
        left: 22px;
        top: 4px;
      }
    }

    
    .filters-bar {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr 56px;
      gap: 8px;
      
      margin-bottom: var(--stack-gap);
      align-items: stretch;
}

    .filter-btn {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
      padding: 10px 24px 10px 10px;
      background: var(--tg-bg-elevated);
      border: 1px solid var(--tg-border-subtle);
      border-radius: 18px;
      color: var(--tg-text);
      cursor: pointer;
      transition: background var(--transition-fast), border-color var(--transition-fast);
      white-space: normal;
      width: 100%;
      position: relative;
      height: 56px;
      text-align: left;
      overflow: hidden;
      row-gap: 2px;
    }
    .filter-btn--single {
      flex-direction: row;
      align-items: center;
      justify-content: flex-start;
      text-align: left;
    }

    .filter-btn--single .filter-label {
      display: none !important;
    }

    .filter-btn--single .filter-value {
      width: 100%;
      justify-content: flex-start;
    }

    .filter-btn--single .filter-value-pill {
      margin: 0;
    }


    .filter-btn:hover {
      background: var(--tg-bg-elevated-soft);
      border-color: var(--tg-border);
    }

    .filter-btn.active {
      background: rgba(42, 174, 93, 0.12);
      border-color: var(--tg-accent);
    }

    .filter-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    
    #advanced-trigger {
      padding: 0;
      width: 56px;
      min-width: 56px;
      flex: 0 0 56px;
      align-items: center;
      justify-content: center;
      border-radius: 18px;
      height: 56px;
      background: var(--tg-bg-elevated);
      color: #FFFFFF;
      position: relative;
      display: flex;
    }

    #advanced-trigger .filter-label,
    #advanced-trigger .filter-value {
      display: none !important;
    }

    #advanced-trigger::before {
      content: "";
      display: block;
      width: 14px;
      height: 14px;
      border-right: 2px solid currentColor;
      border-bottom: 2px solid currentColor;
      position: absolute;
      top: 51%;
      left: 50%;
      transform: translate(-50%, -50%) rotate(45deg);
      transition: transform var(--transition-fast);
    }

    
    #advanced-trigger.active {
      background: var(--tg-bg-elevated);
      color: #FFFFFF;
      border-color: var(--tg-border-subtle);
    }

    #advanced-trigger.active::before {
      transform: translate(-50%, -50%) rotate(-135deg);
    }

    #advanced-trigger.has-advanced::after {
      content: "";
      position: absolute;
      top: 8px;
      right: 8px;
      width: 7px;
      height: 7px;
      border-radius: 999px;
      background: var(--tg-accent);
      box-shadow: none;
    }

    .filter-label {
      color: var(--tg-text-mute);
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
      line-height: 1.2;
      display: block !important;
      text-align: left;
    }

    .filter-value {
      color: var(--tg-text);
      font-weight: 600;
      font-size: 14px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
      min-width: 0;
      line-height: 1.2;
      text-align: left;
      display: flex;
      align-items: center;
      gap: 4px;
    }

    
    .filter-value-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      max-width: 100%;
      min-width: 0;
    }

    .filter-value-icon {
      width: 24px;
      height: 24px;
      border-radius: 8px;
      flex-shrink: 0;
      background: transparent;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      font-size: 10px;
      font-weight: 600;
    }

    .filter-value-backdrop-dot {
      width: 16px;
      height: 16px;
      border-radius: 999px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 2px solid rgba(255, 255, 255, 0.1);
    }

    .filter-value-icon img {
      width: 100%;
      height: 100%;
      border-radius: 6px;
      object-fit: contain;
    }

    .filter-value-text {
      flex: 1;
      min-width: 0;
      font-size: 13px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .filter-value-count {
      font-size: 14px;
      font-weight: 700;
      text-align: left;
      padding-left: 0;
    }

    
    .advanced-panel {
      background: transparent;
      border-radius: 0;
      padding: 0;
      margin-bottom: 0;
      overflow: hidden;
      max-height: 0;
      opacity: 0;
      transform: translateY(-4px);
      transition: max-height 320ms cubic-bezier(0.16, 1, 0.3, 1),
                  opacity 320ms cubic-bezier(0.16, 1, 0.3, 1),
                  transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
      border: none;
    }

    .advanced-panel.open {
      max-height: 80px; 
      opacity: 1;
      transform: translateY(0);
      padding: 0;
      
      margin-top: 0;
      margin-bottom: var(--stack-gap);
      border: none;
    }

    

    
    input[type="search"]::-webkit-search-cancel-button,
    input[type="search"]::-webkit-search-decoration,
    input[type="search"]::-webkit-search-results-button,
    input[type="search"]::-webkit-search-results-decoration {
      -webkit-appearance: none;
      appearance: none;
    }
    .advanced-search {
      position: relative;
      margin-bottom: 0;

      /* Field chrome is on the wrapper to avoid corner color artifacts */
      background: #282727;
      border: 1px solid var(--tg-border-subtle);
      border-radius: 18px;
      overflow: hidden;
    }

    .search-input {
      width: 100%;
      padding: 9px 36px 9px 34px;
      border: none;
      border-radius: 0;
      outline: none;
      background: transparent;
      background-clip: padding-box;
      color: var(--tg-text);

      font-size: 16px;
      font-family: inherit;
    }

    .search-input::placeholder {
      color: var(--tg-text-mute);
  text-align: left;
    }

    .search-input:focus {
      box-shadow: none;
    }

    .search-icon {
      position: absolute;
      left: 13px;
      top: 50%;
      transform: translateY(-50%);
      width: 18px;
      height: 18px;
      pointer-events: none;
      box-sizing: border-box;
      background-repeat: no-repeat;
      background-position: center;
      background-size: 16px 16px;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='6' stroke='rgba(148,155,164,1)' stroke-width='2' fill='none'/%3E%3Cline x1='15' y1='15' x2='20' y2='20' stroke='rgba(148,155,164,1)' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    }

    

    .search-clear {
      position: absolute;
      right: 12px;
      top: 50%;
      transform: translateY(-50%);
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: var(--tg-text-mute);
      border: none;
      color: var(--tg-bg);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity var(--transition-fast);
      font-size: 16px;
      line-height: 1;
      padding: 0;
    }

    .search-clear.visible {
      opacity: 1;
      pointer-events: auto;
    }

    .search-clear:hover {
      background: var(--tg-text-secondary);
    }

    
    
    .inline-reset-btn {
      display: none;
      align-items: center;
      justify-content: center;
      background: var(--tg-bg-elevated-soft);
      border-radius: 999px;
      border: 1px solid var(--tg-border);
      padding: 8px 18px;
      font-size: 14px;
      font-weight: 600;
      color: var(--tg-text-secondary);
      cursor: pointer;
      transition: background var(--transition-fast),
                  border-color var(--transition-fast);
      height: 32px;
      
      margin-top: 0px;
      margin-bottom: var(--stack-gap);
      margin-left: 0;
      width: auto;
      min-width: 0;
    }

    .inline-reset-btn.inline-reset-btn--visible {
      display: flex;
    }


    .inline-reset-btn:hover {
      background: var(--tg-bg-elevated-soft);
      border-color: var(--tg-border);
    }

    
    .gift-grid {
      display: grid;
      
      grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
      justify-content: start;
      justify-items: stretch;
      gap: 16px;
      margin-bottom: 20px;
      align-items: stretch;
    }

    
    .gift-grid > .gift-card:only-child {
      width: min(260px, 100%);
      justify-self: start;
    }

    .gift-card {
      background: var(--tg-bg-elevated);
      border-radius: 22px;
      padding: 10px;
      overflow: hidden;
      border: 1px solid var(--tg-border-subtle);
      box-shadow: none;
      cursor: pointer;
      position: relative;
      display: flex;
      flex-direction: column;
      height: 100%;
    }


    @keyframes cardAppear {
      from {
        opacity: 0;
        transform: translateY(10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .gift-card:hover {
      background: var(--tg-bg-elevated-soft);
    }


.gift-card--unavailable:hover,


    
    .gift-card--removing {
      opacity: 0;
      transform: scale(0.98);
      transition: opacity 180ms ease, transform 180ms ease;
      pointer-events: none;
    }
.gift-card--bought:hover {
  background: var(--tg-bg-elevated);
}

    
    .gift-card--unavailable,
    .gift-card--bought {
      cursor: default;
    }

    .gift-card--unavailable {
      opacity: 0.82;
    }

    .gift-card--unavailable .gift-image,
    .gift-card--unavailable .color-block {
      filter: grayscale(1);
      opacity: 0.82;
    }

    .gift-card--bought {
      opacity: 1;
      background: rgba(42, 174, 93, 0.06);
    }

    
    .gift-card--bought .gift-image,
    .gift-card--bought .color-block {
      filter: grayscale(0.15) sepia(0.55) hue-rotate(85deg) saturate(2.2) brightness(0.95);
      opacity: 1;
    }

    .gift-card--bought .gift-image-wrap::after {
      content: "";
      position: absolute;
      inset: 0;
      background: rgba(42, 174, 93, 0.26);
      pointer-events: none;
    }

    .gift-card--locked {
      cursor: default;
      opacity: 0.9;
      pointer-events: none;
    }

    .gift-card--locked .gift-image-wrap::after {
      content: "";
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.12);
      pointer-events: none;
    }

    .gift-card-locked {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      justify-content: center;
      width: max-content;
      max-width: calc(100% - 24px);
      pointer-events: none;
      z-index: 2;
    }

    .gift-card-locked-text {
      padding: 6px 12px;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.55);
      color: #ffffff;
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      line-height: 1.1;
      text-align: center;
    }

    .gift-card-locked-title {
      font-size: 13px;
      font-weight: 700;
    }

    .gift-card-locked-sub {
      font-size: 11px;
      font-weight: 600;
      opacity: 0.9;
    }

    .gift-card-unavailable-text {
      padding: 6px 12px;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.55);
      color: #ffffff;
      font-size: 13px;
      font-weight: 600;
      text-align: center;
    }

    .gift-card-bought {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      justify-content: center;
      width: max-content;
      max-width: calc(100% - 24px);
      pointer-events: none;
      z-index: 2;
    }

    .gift-card-unavailable {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      justify-content: center;
      width: max-content;
      max-width: calc(100% - 24px);
      pointer-events: none;
      z-index: 2;
    }

    .gift-card-bought-text {
      padding: 6px 12px;
      border-radius: 999px;
      
      background: var(--tg-green);
      color: #ffffff;
      font-size: 13px;
      font-weight: 700;
      text-align: center;
    }
.gift-image-wrap {
      position: relative;
      aspect-ratio: 1 / 1;
      border-radius: 18px;
      overflow: hidden;
      background: var(--tg-bg);
      display: flex;
      align-items: center;
      justify-content: center;
    }


    .color-block {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      font-weight: bold;
      color: white;
      transition: none;
    }

    .gift-card:hover .color-block {
      transform: none;
    }

    .gift-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      
      object-position: center;
      transform: none;
      transform-origin: center;
      transition: none;
    }

    .gift-card:hover .gift-image {
      transform: none;
    }

    .gift-info {
      padding: 10px 4px 0;
      border-radius: 0;
      position: relative;
      flex: 1;
      display: flex;
      flex-direction: column;
    }


    .gift-name {
      font-size: 17px;
      font-weight: 600;
      color: var(--tg-text);
      margin-bottom: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.25;
    }


    .gift-number {
      font-size: 14px;
      color: var(--tg-text-mute);
      font-family: var(--font-sans);
      font-weight: 500;
      letter-spacing: 0.03em;
      margin-bottom: 8px;
      line-height: 1.25;
    }

    
    .gift-buy-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      width: 100%;
      background: var(--tg-accent);
      color: #ffffff;
      border: none;
      border-radius: 14px;
      padding: 0 16px;
      cursor: pointer;
      box-shadow: none;
      font-size: 18px;
      font-weight: 600;
      margin-top: auto;
      font-family: var(--font-sans);
      min-height: 40px;
      line-height: 1.2;
      text-align: center;
    }
    .gift-buy-btn:hover {
      background: #1a7de8;
    }
    .gift-buy-btn:active {}

    
    .gift-card--unavailable .gift-buy-btn {
      background: rgba(255, 255, 255, 0.10);
      color: rgba(255, 255, 255, 0.72);
      cursor: default;
    }

    .gift-card--unavailable .gift-buy-btn:hover {
      background: rgba(255, 255, 255, 0.10);
    }

    .gift-card--unavailable .gift-buy-btn .price-value,
    .gift-card--unavailable .gift-buy-btn .price-currency {
      opacity: 0.95;
    }

    .gift-card--bought .gift-buy-btn {
      background: var(--tg-green);
      color: #ffffff;
      cursor: default;
    }

    .gift-card--bought .gift-buy-btn:hover,
    .gift-card--bought .gift-buy-btn:active {
      background: var(--tg-green);
    }

    .gift-card--bought .gift-buy-btn:hover {
      background: var(--tg-green);
    }


    

.gift-card--bought .gift-buy-btn:disabled {
      opacity: 1;
    }

    .gift-card--locked .gift-buy-btn {
      background: var(--tg-green);
      color: #ffffff;
      cursor: default;
    }

    .gift-card--locked .gift-buy-btn:hover,
    .gift-card--locked .gift-buy-btn:active {
      background: var(--tg-green);
    }

    .gift-card--locked .gift-buy-btn:disabled {
      opacity: 1;
    }


    .price-value {
      display: inline-block;
      font-weight: 700;
      font-size: 18px;
      letter-spacing: 0.01em;
      font-family: var(--font-sans);
      text-shadow: none;
      font-feature-settings: "tnum" 1;
      line-height: 1.1;
    }

    .price-currency {
      display: inline-block;
      font-size: 18px;
      font-weight: 600;
      opacity: 0.95;
      font-family: var(--font-sans); 
      text-shadow: none;
      margin-left: 4px;
      letter-spacing: 0;
      line-height: 1.1;
    }

    
    .empty-state {
      margin: 40px auto 0;
      padding: 0 20px 32px;
      max-width: 320px;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
    }

    .empty-state-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 8px;
    }

    .empty-state-icon-svg {
      width: 40px;
      height: 40px;
      display: block;
      filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
    }

    
    .empty-state-icon-svg--mono {
      color: var(--tg-text-secondary);
    }
.empty-state-title {
      font-size: 17px;
      font-weight: 600;
      margin-bottom: 2px;
      color: var(--tg-text);
      line-height: 1.35;
    }

    .empty-state-subtitle {
      font-size: 14px;
      color: var(--tg-text-mute);
      margin-bottom: 18px;
      line-height: 1.5;
      max-width: 280px;
    }

    .btn-outline {
      background: transparent;
      border: 1px solid var(--tg-border);
      border-radius: 20px;
      padding: 12px 26px;
      color: var(--tg-text);
      font-size: 15px;
      font-weight: 500;
      cursor: pointer;
      transition: all var(--transition-fast);
      font-family: inherit;
      height: 46px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .btn-outline:hover {
      background: rgba(255, 255, 255, 0.05);
      border-color: var(--tg-accent);
    }

    
    .load-more {
      text-align: center;
      padding: 24px;
      color: var(--tg-text-mute);
      font-size: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .load-more-spinner {
      display: inline-block;
      width: 20px;
      height: 20px;
      border: 2px solid var(--tg-border-subtle);
      border-top-color: var(--tg-accent);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    
    .spinner {
      display: inline-block;
      width: 16px;
      height: 16px;
      border: 2px solid rgba(255, 255, 255, 0.35);
      border-top-color: rgba(255, 255, 255, 0.95);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      vertical-align: -3px;
      flex: 0 0 16px;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 0px 0 0px 0;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.55);
opacity: 0;
  visibility: hidden;
  pointer-events: none;
  
  transition: opacity 320ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0ms linear 320ms;
}

.modal-overlay.open,
.modal-overlay.closing {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  visibility: visible;
  transition: opacity 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay.closing {
  opacity: 0;
  pointer-events: none;
}

.modal {
  width: 100%;
  
  height: calc(100% - 4px);
  max-height: calc(100% - 4px);
  background: #1f2124;
  border-radius: 26px 26px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  
  border: none;
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.55);
  transform: translate3d(0, 100%, 0);
  
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}


.modal-overlay.open .modal {
  transform: translate3d(0, 0, 0);
}

.modal-header {
  padding: 16px 18px 10px;
  text-align: left;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-title-wrap {
  flex: 1;
  min-width: 0;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--tg-text);
  margin-bottom: 4px;
  line-height: 1.15;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--tg-text-mute);
  line-height: 1.4;
}

.modal-close-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: var(--tg-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background-color var(--transition-fast);
}

.modal-close-btn:active {
  transform: none;
}

.modal-search {
  padding: 0 18px 10px;
}

.modal-search .search-input {
  height: 46px;
  font-size: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;

  padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='6' stroke='rgba(148,155,164,1)' stroke-width='2' fill='none'/%3E%3Cline x1='15' y1='15' x2='20' y2='20' stroke='rgba(148,155,164,1)' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
  background-size: 16px 16px;
}

.modal-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  scroll-behavior: auto;
}

.modal-list::-webkit-scrollbar {
  display: none;
}

.modal-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  transition: none;
  background: none;
  border: 0;
  width: 100%;
  color: var(--tg-text);
  text-align: left;
  min-height: 72px;
  border-bottom: none;
  position: relative;
}


.modal-item::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.modal-item:hover {
  background: none;
}

.modal-item.active {
  background: none;
}

.modal-item:last-child {
  border-bottom: none;
}

.modal-item:last-child::after {
  display: none;
}

.modal-item.selected {
  background: none;
}

.item-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-size: 12px;
}

.item-icon-default {
  border-radius: 14px;
  overflow: hidden;
}

.item-icon-backdrop {
  /* No circle masks in filter lists */
  border-radius: 14px;
}

.item-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.item-info {
  flex: 1;
  min-width: 0;
  margin-right: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 48px;
}

.item-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--tg-text);
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.item-subtitle {
  font-size: 13px;
  color: var(--tg-text-mute);
  line-height: 1.25;
  margin-top: 2px;
}

.item-price {
  text-align: right;
  flex-shrink: 0;
  min-width: 104px;
}

.price-value-modal {
  font-size: 18px;
  font-weight: 700;
  color: var(--tg-text);
  margin-bottom: 2px;
  line-height: 1.2;
}

.price-label {
  font-size: 12px;
  color: var(--tg-text-mute);
  line-height: 1.2;
}

.modal-footer {
  padding: 16px 18px calc(16px + 0px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 12px;
}

.modal-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  border: none;
  font-family: inherit;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-btn:active {
  transform: none;
}

.modal-btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.modal-btn.primary {
  background: var(--tg-accent);
  color: white;
}

.modal-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.modal-btn.primary:hover {
  background: var(--tg-accent);
}


    
    .toast {
      position: fixed;
      /* Top notification (requested): show under the Telegram safe area */
      top: calc(0px + 14px);
      left: 50%;
      transform: translateX(-50%) translateY(-14px);
      background: var(--tg-bg-elevated);
      border: 1px solid var(--tg-border);
      border-radius: 20px;
      padding: 12px 20px;
      font-size: 14px;
      color: var(--tg-text);
      display: flex;
      align-items: center;
      gap: 10px;
      opacity: 0;
      pointer-events: none;
      transition: all var(--transition-fast);
      z-index: 1200;
      max-width: 90%;
      white-space: normal;
      word-break: break-word;
backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    .toast.visible {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
      /* Blur on toasts causes severe GPU artifacts in Telegram WebView */
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    .toast-emoji {
      font-size: 16px;
      flex-shrink: 0;
    }

    
    .scroll-top-btn {
      position: absolute;
      right: 18px;
      bottom: 18px;
      width: 52px;
      height: 52px;
      border-radius: 18px;
      border: 1px solid var(--tg-border-subtle);
      outline: none;
      background: rgba(29, 29, 29, 0.82);
      color: var(--tg-text);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
      opacity: 0;
      transform: translateY(8px);
      pointer-events: none;
      transition: opacity 140ms, transform 140ms, background var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
      z-index: 980;
backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    .scroll-top-btn:hover {
      background: rgba(38, 38, 38, 0.92);
      border-color: var(--tg-border);
    }

    .scroll-top-btn:active {
      transform: translateY(9px) scale(0.98);
    }

    .scroll-top-btn.visible {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }

    .scroll-top-btn:active {
      transform: translateY(1px);
      box-shadow: none;
    }

    .scroll-top-btn-icon {
      font-size: 18px;
      line-height: 1;
      font-weight: 800;
      transform: translateY(-1px);
    }

    
    .skeleton {
      background: #1c1e21;
    }

    @keyframes loading {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    
    .modal-check {
      width: 28px;
      height: 28px;
      border-radius: 11px;
      border: 1.6px solid rgba(255, 255, 255, 0.20);
      margin-right: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      background: rgba(255, 255, 255, 0.03);
      transition: none;
    }

    .modal-check-icon {
      width: 15px;
      height: 11px;
      background-image: url("data:image/svg+xml,%3Csvg%20width='16'%20height='12'%20viewBox='0%200%2016%2012'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cpath%20d='M2%206.5L5.5%2010L14%202'%20fill='none'%20stroke='white'%20stroke-width='2.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: center;
      background-size: contain;
      opacity: 0;
      transition: none;
      pointer-events: none;
    }

    .modal-item.selected .modal-check {
      border-color: var(--tg-accent);
      background: var(--tg-accent);
      box-shadow: none;
    }

    .modal-item.selected .modal-check-icon {
      opacity: 1;
    }

    
    .filter-btn:not(#advanced-trigger)::before,
    .filter-btn:not(#advanced-trigger)::after {
      content: "";
      position: absolute;
      right: 10px;
      width: 7px;
      height: 7px;
      border-radius: 2px;
      border-right: 1.5px solid var(--tg-text-secondary);
      border-bottom: 1.5px solid var(--tg-text-secondary);
      opacity: 0.7;
      pointer-events: none;
      transition: opacity var(--transition-fast), border-color var(--transition-fast);
    }

    
    .filter-btn:not(#advanced-trigger)::before {
      top: 46%;
      transform: translateY(-50%) rotate(-135deg);
    }

    
    .filter-btn:not(#advanced-trigger)::after {
      top: 54%;
      transform: translateY(-50%) rotate(45deg);
    }

    .filter-btn:not(#advanced-trigger):disabled::before,
.filter-btn:not(#advanced-trigger):disabled::after {
      opacity: 0.3;
    }


    
    .filter-btn.active:not(#advanced-trigger)::before,
    .filter-btn.active:not(#advanced-trigger)::after {
      opacity: 1;
      border-color: var(--tg-accent);
    }

    
    .error-state {
      text-align: center;
      padding: 60px 20px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    
    @media (max-width: 520px) {
      body {
        padding: 0;
        align-items: stretch;
      }

      .app-shell {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
      }

      main {
        padding: 2px 12px calc(16px + 0px);
      }

      .filters-bar {
        gap: 6px;
      }

      .filter-btn {
        padding: 10px 24px 10px 10px;
        height: 56px;
        min-height: 56px;
      }

      .gift-grid {
        gap: 12px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      
      .gift-card {
        width: 100%;
        max-width: none;
        justify-self: stretch;
      }

      .modal {
        max-height: calc(100% - 12px);
      }

      .inline-reset-btn {
        margin-left: 0;
        padding: 7px 14px;
        font-size: 12px;
      }
    }

    .modal-list,
    main,
    .filters-bar {
      -ms-overflow-style: none;
      scrollbar-width: none;
    }

    .modal-list::-webkit-scrollbar,
    main::-webkit-scrollbar,
    .filters-bar::-webkit-scrollbar {
      display: none;
    }

    
    .modal-overlay {
      cursor: pointer;
    }
    
    .modal-overlay .modal {
      cursor: default;
    }

    
    button:focus-visible,
    input:focus-visible {
      outline: none;
      box-shadow: none;
    }

    
    h1, h2, h3, h4, h5, h6, p {
      line-height: 1.4;
    }
  
    
    
    .gift-sheet-overlay {
      position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--tg-viewport-height, var(--app-height, 100vh));
  min-height: var(--tg-viewport-stable-height, var(--tg-viewport-height, var(--app-height, 100vh)));
  padding: 0px 0 0px 0;
  box-sizing: border-box;
      background: rgba(0, 0, 0, 0.45);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      z-index: 999;
      opacity: 0;
      pointer-events: none;
      transition: opacity 260ms cubic-bezier(0.16, 1, 0.3, 1);
backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    .gift-sheet-overlay.visible {
      opacity: 1;
      pointer-events: auto;
backdrop-filter: blur(2px);
      -webkit-backdrop-filter: blur(2px);
    }

    .gift-sheet {
      position: relative;
      width: 100%;
      max-width: none;
      border-radius: 24px 24px 0 0;
      background: #1d1d1d;
      box-shadow: none;
      
      padding: 14px 16px calc(20px + 0px);
      margin: 0;
      color: var(--tg-text);
      transform: translateY(100%);
      transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
    }

    .gift-sheet.open {
      transform: translateY(0);
    }

    .gift-sheet.dragging {
      transition: none !important;
    }

    
    .gift-sheet-drag-handle {
      display: block;
      width: 44px;
      height: 5px;
      border-radius: 999px;
      margin: 6px auto 10px;
      background: rgba(255, 255, 255, 0.18);
    }

    .gift-sheet-close {
      position: absolute;
      top: 12px;
      right: 12px;
      width: 44px;
      height: 44px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(0,0,0,0.25);
      color: #ffffff;
      cursor: pointer;
      font-size: 26px;
      font-weight: 800;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      -webkit-tap-highlight-color: transparent;
    }

    .gift-sheet-close:hover {
      background: rgba(0,0,0,0.35);
    }

    .gift-sheet-header {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 0;
      margin-bottom: 8px;
    }

    .gift-sheet-visual {
      position: relative;
      width: 280px;
      height: 280px;
      border-radius: 28px;
      background: transparent;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 12px;
    }

    .gift-sheet-lottie {
      position: relative;
      width: 100%;
      height: 100%;
      border-radius: 32px;
      overflow: hidden;
    }

    
    .gift-sheet-lottie { z-index: 1; }
    .gift-sheet-card-caption--overlay { z-index: 10; }

    .gift-sheet-preview-img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: inherit;
    }

    .gift-sheet-lottie-anim {
      position: absolute;
      inset: 0;
    }

    .gift-sheet-lottie-anim canvas,
    .gift-sheet-lottie-anim svg {
      width: 100% !important;
      height: 100% !important;
      display: block;
      background: transparent !important;
      outline: none !important;
      transform: none;
      transform-origin: center;
    }

    .gift-sheet-fallback {
      width: 100%;
      height: 100%;
      border-radius: inherit;
      
      background: transparent;
    }

    
    .gift-sheet-tap-hint {
      width: min(340px, calc(100% - 32px));
      margin: 10px auto 0;
      font-size: 13px;
      line-height: 16px;
      font-weight: 500;
      text-align: center;
      color: rgba(255, 255, 255, 0.78);
      pointer-events: none;
      user-select: none;
      transition: opacity 160ms ease;
      display: block;
    }

    .gift-sheet-tap-hint.is-hidden {
      opacity: 0;
    }

    .gift-sheet-card-caption {
      text-align: center;
      color: #ffffff;
    }

    /* Было: подпись поверх анимации. Теперь подпись отдельным блоком ниже превью. */
    .gift-sheet-card-caption--below {
      position: relative;
      left: auto;
      right: auto;
      bottom: auto;
      padding: 0 16px;
      margin: 2px auto 0;
      pointer-events: none;
      text-shadow: none;
    }

    /* Сохраняем класс, но не используем его в разметке */
    .gift-sheet-card-caption--overlay {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 10px;
      padding: 0 16px;
      z-index: 6;
      pointer-events: none;
      text-shadow: none;
    }

    .gift-sheet-card-title {
      font-size: 20px;
      font-weight: 650;
      line-height: 1.25;
      margin: 0 auto;
      max-width: min(360px, calc(100% - 32px));
      white-space: normal;
      overflow: hidden;
      text-overflow: clip;
      
      display: block;
      word-break: break-word;
    }

    .gift-sheet-card-number {
      font-size: 14px;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.82);
      margin-top: 4px;
      line-height: 1.2;
    }

    .gift-sheet--unavailable .gift-sheet-visual {
      filter: grayscale(1);
      opacity: 0.85;
    }

    .gift-sheet--unavailable .gift-sheet-buy-bar {
      background: #3a3a3a;
      cursor: default;
    }

    .gift-sheet--unavailable .gift-sheet-buy-bar:hover {
      background: #3a3a3a;
    }

    .gift-sheet--unavailable .gift-sheet-visual::after {
      content: "Продано";
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: 600;
      color: #ffffff;
      text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
      z-index: 8;
      background: rgba(0, 0, 0, 0.22);
      border-radius: inherit;
    }

    /* Purchased by the current user */
    .gift-sheet--bought .gift-sheet-buy-bar {
      background: var(--tg-green);
      cursor: default;
    }

    .gift-sheet--bought .gift-sheet-buy-bar:hover {
      background: var(--tg-green);
    }

    .gift-sheet--bought .gift-sheet-visual::after {
      content: "";
      position: absolute;
      inset: 0;
      display: none !important;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: 700;
      color: #ffffff;
      text-shadow: 0 0 10px rgba(0, 0, 0, 0.55);
      z-index: 8;
      background: rgba(42, 174, 93, 0.22);
      border-radius: inherit;
      pointer-events: none;
    }

.gift-sheet-traits {
      margin-top: 16px;
      border-radius: 20px;
      background: #262626;
      overflow: hidden;
      border: 1px solid rgba(255, 255, 255, 0.04);
    }

    .gift-sheet-trait-row {
      display: grid;
      grid-template-columns: minmax(0, 0.9fr) minmax(0, 2.1fr);
      font-size: 14px;
    }

    .gift-sheet-trait-row:not(:last-child) {
      border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    }

    .gift-sheet-trait-label {
      padding: 10px 14px;
      background: #3b3a3a;
      color: rgba(255, 255, 255, 0.7);
      display: flex;
      align-items: center;
      justify-content: flex-start;
      font-weight: 500;
    }

    .gift-sheet-trait-value {
      padding: 10px 16px 10px 10px;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 8px;
      font-weight: 500;
    }

    .gift-sheet-trait-name {
      color: var(--tg-accent);
      cursor: default;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      max-width: 170px;
      text-align: right;
    }

    .gift-sheet-trait-rarity {
      font-size: 11px;
      padding: 2px 6px;
      border-radius: 999px;
      background: var(--tg-accent-soft);
      color: var(--tg-accent);
      white-space: nowrap;
    }

    .gift-sheet-buy-bar {
      margin-top: 18px;
      width: 100%;
      border-radius: 14px;
      border: none;
      background: var(--tg-accent);
      cursor: pointer;
      box-shadow: none;
      padding: 12px 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #ffffff;
      font-family: inherit;
      font-size: 17px;
      font-weight: 600;
      text-transform: none;
      height: 52px;
    }

    .gift-sheet-buy-bar:hover {
      background: #1a7de8;
    }

    
    .gift-sheet-buy-bar[data-state="paid_wait"],
    .gift-sheet-buy-bar[data-state="delivering"],
    .gift-sheet-buy-bar[data-state="bought"] {
      background: var(--tg-green);
    }

    .gift-sheet-buy-bar[data-state="paid_wait"]:hover,
    .gift-sheet-buy-bar[data-state="delivering"]:hover,
    .gift-sheet-buy-bar[data-state="bought"]:hover {
      background: #00b86c;
    }

    .gift-sheet-buy-text {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      white-space: nowrap;
    }

@media (max-width: 480px) {
      .gift-sheet {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        padding-bottom: calc(14px + 0px);
      }

      .gift-sheet-visual {
        width: 260px;
        height: 260px;
      }

      .gift-sheet-card-caption--overlay {
        bottom: 14px;
        padding: 0 18px;
      }

      .gift-sheet-card-title {
        font-size: 18px;
        max-width: calc(100% - 36px);
      }
    }

.pay-sheet-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px 4px 0;
}



.gift-sheet.result-sheet {
  width: 100%;
  max-width: none;
  border-radius: 24px 24px 0 0;
  background: var(--tg-bg-elevated);
  border: 1px solid var(--tg-border-subtle);
  box-shadow: none;
  
  padding: 12px 16px calc(12px + 0px);
  margin: 0;
  color: var(--tg-text);
  max-height: 62vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.result-sheet-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding-top: 6px;
}

.result-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.result-icon-svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

.result-icon--success {
  background: rgba(42, 174, 93, 0.90);
}

.result-icon--fail {
  background: rgba(255, 80, 80, 0.90);
}

.result-sheet-close {
      position: absolute;
      top: 12px;
      right: 12px;
      width: 44px;
      height: 44px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,0.08);
      background: rgba(0,0,0,0.25);
      color: #ffffff;
      cursor: pointer;
      font-size: 26px;
      font-weight: 800;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      -webkit-tap-highlight-color: transparent;
    }

.result-sheet-close:active {
  transform: translateY(1px);
}

.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding-top: 10px;
}

.result-emoji {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 2px;
  transform: scale(0.9);
  filter: drop-shadow(0 14px 40px rgba(0, 0, 0, 0.45));
}

@media (max-width: 480px) {
  .result-emoji { font-size: 78px; }
}

.ios-emoji {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) inset, 0 10px 28px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transform: scale(0.86);
}

.ios-emoji--success {
  background: linear-gradient(180deg, #2AAE5D 0%, #1E8A48 100%);
}

.ios-emoji--fail {
  background: linear-gradient(180deg, #ff4c4c 0%, #d92d2d 100%);
}

.ios-emoji-shine {
  position: absolute;
  inset: -12px;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 55%);
  opacity: 0.9;
  pointer-events: none;
}

.ios-emoji-svg {
  width: 70px;
  height: 70px;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.15));
}

.ios-emoji-check,
.ios-emoji-x {
  fill: none;
  stroke: rgba(0, 0, 0, 0.28);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
}

.result-title {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-top: 2px;
}


.result-subtitle {
  font-size: 16px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);

  width: 100%;
  box-sizing: border-box;
  padding: 0 2px;}


.result-actions {
  width: 100%;
  margin-top: 8px;
}

.result-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: none;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.result-btn--primary {
  background: var(--tg-accent);
  color: #ffffff;
}

.result-btn--secondary {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.result-btn--success {
  background: var(--tg-green);
  color: #ffffff;
}

.result-btn--danger {
  background: linear-gradient(180deg, rgba(255, 90, 90, 0.98), rgba(215, 45, 45, 0.98));
  color: #ffffff;
}

.result-btn:active {
  transform: translateY(1px);
}


.gift-sheet.result-sheet.open .ios-emoji {
  animation: emoji-pop 520ms cubic-bezier(0.2, 0.9, 0.2, 1.2) both;
}

.gift-sheet.result-sheet.open .ios-emoji-check,
.gift-sheet.result-sheet.open .ios-emoji-x {
  animation: emoji-stroke 560ms ease-out 140ms forwards;
}

@keyframes emoji-pop {
  0% { transform: scale(0.78); filter: none; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes emoji-stroke {
  to { stroke-dashoffset: 0; }
}

@media (max-width: 480px) {
  .gift-sheet.result-sheet {
    margin-bottom: 0;
    max-width: 100%;
  }
  .ios-emoji { width: 86px; height: 86px; }
  .result-title { font-size: 25px; }
}

.pay-sheet-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 34px;
  font-weight: 800;
  margin: 0 auto 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pay-sheet-icon--success {
  color: var(--tg-green);
  background: linear-gradient(180deg, rgba(42, 174, 93, 0.18), rgba(0, 0, 0, 0));
  box-shadow: 0 0 0 1px rgba(42, 174, 93, 0.20), 0 16px 40px rgba(42, 174, 93, 0.12);
}

.pay-sheet-icon--fail {
  color: var(--tg-red);
  background: linear-gradient(180deg, rgba(242, 63, 66, 0.18), rgba(0, 0, 0, 0));
  box-shadow: 0 0 0 1px rgba(242, 63, 66, 0.18), 0 16px 40px rgba(242, 63, 66, 0.10);
}


.pay-sheet--price .pay-sheet-icon--price {
  background: rgba(255, 208, 80, 0.95);
  border-color: rgba(255, 208, 80, 0.25);
  color: rgba(20, 20, 20, 0.9);
  box-shadow: none;
}

.pay-action--price {
  background: rgba(255, 208, 80, 0.95) !important;
  color: rgba(20, 20, 20, 0.95) !important;
}

.pay-action--price:hover {
  background: rgba(255, 208, 80, 0.9) !important;
}

.pay-sheet-title {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.pay-sheet-subtitle {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--tg-text-secondary);

  width: 100%;
  box-sizing: border-box;
  padding: 0 2px;}

.pay-sheet-card {
  margin-top: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
}

.pay-sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pay-sheet-row span {
  font-size: 13px;
  color: var(--tg-text-secondary);
}

.pay-sheet-row b {
  font-size: 14px;
  font-weight: 650;
}

.pay-sheet-hint {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
}

.pay-sheet-hint--muted {
  color: rgba(255, 255, 255, 0.68);
}

.pay-sheet-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pay-action {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  min-height: 52px;
  transition: transform 0.08s ease, background 0.12s ease, opacity 0.12s ease;
}

.pay-action:active {
  transform: scale(0.99);
}

.pay-action--primary {
  background: var(--tg-accent);
  color: #fff;
}

.pay-action--primary:hover {
  background: #1a7de8;
}

.pay-action--secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #fff;
}

.pay-action--secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.pay-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pay-action-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

    
    .app-shell {
      border: none;
    }


@media (max-width: 520px) {
  body {
    font-size: 16px;
  }

  .app-shell {
    padding-top: 0px;
    padding-bottom: 0px;
    padding-left: 0;
    padding-right: 0;
  }

  .filters-bar {
    gap: 10px;
}

  .filter-btn {
    height: 60px;
    min-height: 60px;
    padding: 12px 24px 12px 12px;
    border-radius: 20px;
  }

  .filter-label {
    font-size: 13px;
  }

  .filter-value {
    font-size: 15px;
  }

  .filter-value-text,
  .filter-value-count {
    font-size: 14px;
  }

  .search-input {
    min-height: 44px;
    padding: 12px 40px 12px 36px;
    font-size: 15px;
  }

  .inline-reset-btn {
    padding: 9px 18px;
    font-size: 13px;
  }

  .btn-outline,
  .gift-buy-btn {
    min-height: 38px;
  }

  .gift-card {
    border-radius: 24px;
    padding: 12px;
  }
}







.gift-card--bought {
  background:
    linear-gradient(135deg, rgba(42, 174, 93, 0.16), rgba(36, 139, 254, 0.12));
  box-shadow: 0 0 0 1px rgba(42, 174, 93, 0.55), 0 18px 40px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.gift-card--bought .gift-card-media {
  opacity: 0.85;
  filter: saturate(1.05);
}

.gift-card--bought .gift-buy-btn {
  background: var(--tg-green) !important;
  color: #ffffff;
}

.gift-card--bought-anim {
  animation: giftBoughtPulse 900ms ease-out 1;
}

@keyframes giftBoughtPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.gift-card-bought-text {
  background: rgba(42, 174, 93, 0.95);
}


.maintenance-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
  background: #000;
}

.maintenance-overlay.visible {
  display: flex;
}

.maintenance-message {
  width: 100%;
  max-width: 92vw;
  text-align: center;
  padding: 0 8px;
}

.maintenance-title {
  font-size: clamp(22px, 7vw, 36px);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  color: #ffffff;
}

.maintenance-text {
  margin-top: 12px;
  font-size: clamp(14px, 4.6vw, 20px);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.75);
}




.top-promo-text {
  flex: 1;
  min-width: 0;
  max-width: none;
}

.top-promo-art {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.14);
}

.top-promo-art-img {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  object-fit: cover;
}

@media (max-width: 480px) {
  
  .top-promo-banner {
    padding: 0;
  }
  .top-promo-art {
    width: 56px;
    height: 56px;
  }
  .top-promo-art-img {
    width: 56px;
    height: 56px;
  }
}



.boot-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: var(--tg-viewport-height, var(--app-height, 100vh));
  min-height: var(--tg-viewport-stable-height, var(--tg-viewport-height, var(--app-height, 100vh)));

  padding-top: 0px;
  padding-bottom: 0px;
  box-sizing: border-box;

  z-index: 100000 !important;
  display: flex;
  align-items: center;
  justify-content: center;

  background: #000000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.boot-loader.visible {
  opacity: 1;
  pointer-events: auto;
}

.boot-loader.boot-loader--hide {
  opacity: 0;
  pointer-events: none;
}

.boot-loader-inner {
  width: min(320px, 88vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.boot-loader-logo {
  display: none;
}

.boot-loader-lottie {
  width: clamp(92px, 28vw, 140px);
  height: clamp(92px, 28vw, 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.boot-loader-lottie svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.boot-loader-logo-img {
  width: 60px;
  height: 60px;
  display: block;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.35));
}

.boot-loader-title {
  
  font-size: clamp(16px, 5.2vw, 22px);
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
}

.boot-loader-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
}

.boot-loader-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  overflow: hidden;
  margin-top: 6px;
}

.boot-loader-bar-fill {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  animation: bootLoaderMove 1100ms ease-in-out infinite;
}

@keyframes bootLoaderMove {
  0%   { transform: translateX(-80%); }
  50%  { transform: translateX(80%); }
  100% { transform: translateX(-80%); }
}



.gift-card-unavailable,
.gift-card-bought {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 3 !important;
  pointer-events: none !important;
  border-radius: inherit;
  
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: none !important;
  transform: none !important;
}


.gift-card--bought .gift-image-wrap::after,
.gift-card--unavailable .gift-image-wrap::after {
  content: none !important;
}


.gift-card--bought .gift-image {
  filter: grayscale(0.05) sepia(0.55) hue-rotate(85deg) saturate(3.6) brightness(0.95) contrast(1.05) !important;
}


.gift-card-unavailable {
  background: rgba(0, 0, 0, 0.72) !important;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

.gift-card--unavailable .gift-card-unavailable-text {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  color: rgba(255,255,255,0.95) !important;
  text-shadow: 0 2px 14px rgba(0,0,0,0.55) !important;
}


.gift-card-bought {
  background: rgba(0, 190, 120, 0.26) !important;
}

.gift-card--bought .gift-card-bought-text {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  text-shadow: 0 2px 14px rgba(0,0,0,0.40) !important;
}


.gift-card--bought,
.gift-card--unavailable {
  pointer-events: none !important;
  cursor: default !important;
}


.gift-card--bought {
  outline: none !important;
  box-shadow: none !important;
  border-color: var(--tg-border-subtle) !important;
  background: var(--tg-bg-elevated) !important;
}


.gift-card--bought .gift-buy-btn {
  background: var(--tg-green) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: none !important;
  opacity: 1 !important;
}


.result-sheet-body {
  align-items: center !important;
  text-align: center !important;
}


.modal-close-btn,
.gift-sheet-close,
.result-sheet-close {
  width: 44px !important;
  height: 44px !important;
  font-size: 26px !important;
}



.modal-close-btn,
.gift-sheet-close,
.result-sheet-close,
.search-clear {
  border: none !important;
  background: transparent !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  outline: none !important;
  transition: background var(--transition-fast), transform 180ms cubic-bezier(0.22, 0.61, 0.36, 1) !important;
  will-change: transform;

}

.modal-close-btn:hover,
.gift-sheet-close:hover,
.result-sheet-close:hover,
.search-clear:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active,
.search-clear:active {
  background: rgba(255, 255, 255, 0.12) !important;
}



.modal-close-btn:hover,
.gift-sheet-close:hover,
.result-sheet-close:hover {
  transform: rotate(8deg) scale(1.04) !important;
}

.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active {
  transform: rotate(0deg) scale(0.96) !important;
}

.modal-close-btn:focus-visible,
.gift-sheet-close:focus-visible,
.result-sheet-close:focus-visible,
.search-clear:focus-visible {
  outline: 2px solid rgba(36, 139, 254, 0.65) !important;
  outline-offset: 2px !important;
}

.search-clear {
  color: rgba(255,255,255,0.86) !important;
}





    
    .top-promo-banner {
      position: relative;
      border: 1px solid rgba(255, 214, 120, 0.18);
      box-shadow: 0 14px 38px rgba(0, 0, 0, 0.44);
    }

    .top-promo-banner:not(.top-promo-banner--photo)::before {
      content: "";
      position: absolute;
      inset: 0;
      
      background:
        radial-gradient(circle at 18% 30%, rgba(255,255,255,0.55) 0 1px, rgba(0,0,0,0) 2px),
        radial-gradient(circle at 32% 22%, rgba(255,255,255,0.35) 0 1px, rgba(0,0,0,0) 2px),
        radial-gradient(circle at 46% 42%, rgba(255,255,255,0.38) 0 1px, rgba(0,0,0,0) 2px),
        radial-gradient(circle at 62% 24%, rgba(255,255,255,0.30) 0 1px, rgba(0,0,0,0) 2px),
        radial-gradient(circle at 74% 46%, rgba(255,255,255,0.34) 0 1px, rgba(0,0,0,0) 2px),
        radial-gradient(circle at 86% 28%, rgba(255,255,255,0.28) 0 1px, rgba(0,0,0,0) 2px),
        radial-gradient(circle at 90% 62%, rgba(255,255,255,0.20) 0 1px, rgba(0,0,0,0) 2px);
      opacity: 0.55;
      pointer-events: none;
    }

    .top-promo-banner::after {
      content: "";
      position: absolute;
      inset: 0;
      
      background: linear-gradient(125deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.00) 40%, rgba(255,255,255,0.10) 70%, rgba(255,255,255,0.00) 100%);
      pointer-events: none;
      opacity: 0.65;
      mix-blend-mode: overlay;
    }

    .top-promo-slide {
      position: relative;
    }

    .top-promo-slide-primary {
      
      background:
        radial-gradient(circle at 22% 18%, rgba(255,255,255,0.22), rgba(255,255,255,0) 52%),
        radial-gradient(circle at 82% 22%, rgba(255,220,130,0.22), rgba(255,220,130,0) 58%),
        linear-gradient(100deg, rgba(214, 160, 34, 0.92) 0%, rgba(122, 86, 18, 0.92) 46%, rgba(26, 16, 6, 0.94) 100%);
    }

    .top-promo-title {
      text-shadow: none;
    }

    .top-promo-deco {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 8px 10px;
      border-radius: 14px;
      background: rgba(0, 0, 0, 0.18);
      border: 1px solid rgba(255, 214, 120, 0.18);
flex-shrink: 0;
    }

    .top-promo-deco-emoji {
      font-size: 18px;
      line-height: 1;
      filter: none;
    }

    .top-promo-sticker {
      position: absolute;
      z-index: 3;
      font-size: 11px;
      font-weight: 750;
      letter-spacing: 0.01em;
      padding: 4px 8px;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.18);
      border: 1px solid rgba(255, 214, 120, 0.18);
pointer-events: none;
      white-space: nowrap;
    }

    .top-promo-sticker--a {
      top: 8px;
      right: 92px;
      transform: rotate(-2deg);
    }

    .top-promo-sticker--b {
      bottom: 10px;
      right: 14px;
      transform: rotate(2deg);
    }

    
    #payment-success-overlay,
    #payment-fail-overlay {
      background: rgba(0, 0, 0, 0.30);
      backdrop-filter: blur(1px);
      -webkit-backdrop-filter: blur(1px);
    }


.result-lottie {
  width: 124px;
  height: 124px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-lottie svg {
  width: 100%;
  height: 100%;
  display: block;
}



.top-promo-banner--photo {
  position: relative;
  
  height: 94px;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  border: none !important;
  box-shadow: none !important;
  margin: 4px 0 10px;
  transform: translateZ(0);
}

.top-promo-banner--photo::before {
  
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.18) 70%, rgba(0, 0, 0, 0.26) 100%);
  z-index: 1;
  pointer-events: none;
}


.top-promo-banner--photo::after {
  
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(12px 12px at 12% 28%, rgba(255,255,255,0.18), transparent 60%),
    radial-gradient(10px 10px at 38% 62%, rgba(255,255,255,0.12), transparent 62%),
    radial-gradient(14px 14px at 72% 22%, rgba(255,255,255,0.14), transparent 62%),
    radial-gradient(16px 16px at 88% 70%, rgba(255,255,255,0.10), transparent 64%);
  opacity: 0.35;
  animation: bannerSparkleMove 7s ease-in-out infinite;
}

@keyframes bannerSparkleMove {
  0%   { transform: translate3d(0, 0, 0); opacity: 0.28; }
  50%  { transform: translate3d(0, -1px, 0); opacity: 0.42; }
  100% { transform: translate3d(0, 0, 0); opacity: 0.28; }
}

.top-promo-banner--photo:active {
  transform: translateY(1px);
}

.top-promo-banner-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  
  object-fit: cover;
  object-position: center;
  filter: saturate(0.98) brightness(1.00) contrast(1.02);
  border-radius: inherit;
  z-index: 0;
}

.top-banner-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: row;
  
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 12px 14px 10px;
  gap: 12px;
}

.top-banner-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
}

.top-banner-right {
  display: flex;
  justify-content: flex-end;
  align-self: center;
  margin-top: 0;
  flex: 0 0 auto;
}

.top-banner-title {
  font-size: clamp(13px, 4.3vw, 19px);
  font-weight: 850;
  color: #fff;
  line-height: 1.18;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  
  white-space: nowrap;
  
  overflow-x: hidden;
  overflow-y: visible;
  text-overflow: clip;
  padding-bottom: 2px;
}

.top-banner-handle {
  margin-top: 0;
  font-size: 15px;
  font-weight: 850;
  color: rgba(255, 255, 255, 0.96);
  letter-spacing: 0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  line-height: 1.25;
  padding-bottom: 1px;
}

.top-banner-ngline {
  margin-top: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.95);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}



#purchase-cancel-sheet.gift-sheet {
  
  padding-bottom: calc(14px + 0px);
  max-height: 70vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}



.gift-image-wrap {
  position: relative;
}

.gift-card-unavailable,
.gift-card-bought {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gift-card-unavailable-text,
.gift-card-bought-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  font-weight: 900;
  letter-spacing: 0.6px;
  font-size: 18px;
  text-transform: none;
  white-space: nowrap;
}


.gift-card--unavailable .gift-buy-btn,
.gift-card--bought .gift-buy-btn {
  display: flex !important;
}

.result-actions--two {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result-btn--neutral {
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.95);
}




.gift-sheet-drag-handle { display: none !important; }


.modal-close-btn,
.gift-sheet-close,
.result-sheet-close,
.search-clear {
  transition: none !important;
  transform: none !important;
  will-change: auto !important;
}

.modal-close-btn:hover,
.gift-sheet-close:hover,
.result-sheet-close:hover,
.search-clear:hover,
.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active,
.search-clear:active {
  transform: none !important;
}


.top-promo-banner--photo {
  height: 118px !important;
}

@media (max-width: 380px) {
  .top-promo-banner--photo { height: 126px !important; }
  .top-banner-ngline { font-size: 12px !important; padding: 5px 8px !important; }
 }
.top-banner-overlay {
  padding: 12px 14px 12px !important;
}
.top-banner-title { line-height: 1.18 !important; overflow-x: hidden !important; overflow-y: visible !important; padding-bottom: 2px !important; }
.top-banner-handle { line-height: 1.25 !important; padding-bottom: 1px !important; }


.gift-image-wrap { position: relative; }

.gift-card--unavailable .gift-card-unavailable,
.gift-card--bought .gift-card-bought {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: none !important;
  z-index: 4 !important;
}

.gift-card--unavailable .gift-card-unavailable {
  background: rgba(0, 0, 0, 0.38) !important;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

.gift-card--bought .gift-card-bought {
  background: rgba(0, 190, 120, 0.18) !important;
}

.gift-card--unavailable .gift-card-unavailable-text,
.gift-card--bought .gift-card-bought-text {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  padding: 10px 18px !important;
  border-radius: 999px !important;
  background: rgba(0, 0, 0, 0.68) !important;
  color: rgba(255,255,255,0.98) !important;
  font-weight: 900 !important;
  letter-spacing: 0.4px !important;
  font-size: 18px !important;
  text-shadow: 0 2px 14px rgba(0,0,0,0.55) !important;
  white-space: nowrap !important;
}

.gift-card--bought .gift-card-bought-text {
  background: rgba(0, 110, 70, 0.72) !important;
}


#purchase-cancel-overlay.gift-sheet-overlay {
  align-items: flex-end !important;
  padding: 0 !important;
}
#purchase-cancel-sheet.gift-sheet {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 24px 24px 0 0 !important;
}






.ptr-content {
  transform: none;
  transition: none;
}
.ptr-content.ptr-shifted {
  transform: none;
  will-change: auto;
}
.ptr-content.ptr-pulling {
  transition: none;
}


.ptr-indicator {
  top: 0px !important;
  height: 56px;
  align-items: center;
  z-index: 1500;
  opacity: 0;
  transition: opacity 180ms ease-out;
}
.ptr-indicator.active,
.ptr-indicator.ready,
.ptr-indicator.refreshing {
  opacity: 1;
}
.ptr-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(31, 33, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transform: translateY(calc(-56px + var(--ptr-offset, 0px)));
  opacity: 1;
  transition: none;
}
.top-banner-title {
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: clip;
}


@media (max-width: 430px) {
  .top-promo-banner--photo { height: 124px !important; }
  .top-banner-overlay {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .top-banner-right {
    justify-content: flex-start;
    align-self: flex-start;
  }
  .top-banner-ngline {
    font-size: 12px !important;
    padding: 5px 8px !important;
  }
}


/* =====================================================================
   Patch v43 — Compact filter controls (match reference UI)
   - Fix "huge" filter pills on small screens
   - Normalize typography so text baseline looks ровно
   ===================================================================== */

/* Keep the filters row tight and visually consistent */
.filters-bar {
  gap: 8px !important;
  margin-bottom: 10px !important;
}

/* Main dropdown pills */
.filters-bar .filter-btn {
  height: 56px !important;
  min-height: 56px !important;
  padding: 9px 22px 9px 10px !important;
  border-radius: 18px !important;
  row-gap: 1px !important;
}

/* Chevron button (advanced toggle) */
.filters-bar #advanced-trigger {
  height: 56px !important;
  min-height: 56px !important;
  width: 56px !important;
  min-width: 56px !important;
  border-radius: 18px !important;
}

/* Typography: smaller + tighter line-heights (prevents "wobbly" text) */
.filters-bar .filter-label {
  font-size: 12px !important;
  line-height: 1.15 !important;
}

.filters-bar .filter-value {
  font-size: 14px !important;
  line-height: 1.15 !important;
}

.filters-bar .filter-value-text {
  font-size: 13px !important;
  line-height: 1.15 !important;
}

.filters-bar .filter-value-count {
  font-size: 13px !important;
  line-height: 1.15 !important;
}

/* Icons were making pills visually "taller" — shrink slightly */
.filters-bar .filter-value-icon {
  width: 22px !important;
  height: 22px !important;
  border-radius: 7px !important;
}

.filters-bar .filter-value-backdrop-dot {
  width: 14px !important;
  height: 14px !important;
}

/* Mobile: keep compact (override older media rules that inflated pills) */
@media (max-width: 520px) {
  .filters-bar { gap: 8px !important; }
  .filters-bar .filter-btn {
    height: 56px !important;
    min-height: 56px !important;
    padding: 9px 22px 9px 10px !important;
    border-radius: 18px !important;
  }
  .filters-bar #advanced-trigger {
    height: 56px !important;
    min-height: 56px !important;
    width: 56px !important;
    min-width: 56px !important;
    border-radius: 18px !important;
  }
  .filters-bar .filter-label { font-size: 12px !important; }
  .filters-bar .filter-value { font-size: 14px !important; }
}


.top-promo-banner--photo::after {
  display: none !important;
  animation: none !important;
}
.top-promo-banner--photo:active {
  transform: none !important;
}


.gift-card:hover,
.gift-card:active,
.gift-card:focus {
  background: var(--tg-bg-elevated) !important;
}
.modal-close-btn,
.gift-sheet-close,
.result-sheet-close,
.search-clear,
.filters-bar button,
.filters-bar .filter-pill,
.buy-btn,
.gift-buy-btn {
  transition: none !important;
  transform: none !important;
  filter: none !important;
}
.modal-close-btn:hover,
.gift-sheet-close:hover,
.result-sheet-close:hover,
.search-clear:hover {
  background: transparent !important;
}

.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active,
.search-clear:active {
  background: transparent !important;
}


.gift-card--bought-anim {
  animation: none !important;
}


.result-emoji,
.result-emoji * {
  animation: none !important;
}





.modal-close-btn:hover,
.modal-close-btn:active,
.modal-close-btn:focus,
.modal-close-btn:focus-visible,
.gift-sheet-close:hover,
.gift-sheet-close:active,
.gift-sheet-close:focus,
.gift-sheet-close:focus-visible,
.result-sheet-close:hover,
.result-sheet-close:active,
.result-sheet-close:focus,
.result-sheet-close:focus-visible,
.search-clear:hover,
.search-clear:active,
.search-clear:focus,
.search-clear:focus-visible {
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}


/* =====================================================================
   Balance pill (match reference TON style, but RUB)
   - One single pill background (container)
   - Blue round currency dot at left
   - White round + button inside the same pill
   ===================================================================== */

.balance-widget{
  /* keep fixed positioning from earlier rules */
  background-color: rgba(0, 122, 255, 0.16) !important; /* #007AFF29 */
  border-radius: 999px !important;
  padding: 6px 8px !important;
  gap: 8px !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.balance-pill{
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  line-height: 18px !important;
  cursor: pointer !important;
  transform: none !important;
}

.balance-pill:active{ transform: none !important; }

.balance-pill-icon{
  width: 20px !important;
  height: 20px !important;
  border-radius: 999px !important;
  background: #35AFF1 !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  transform: translateY(-0.2px) !important; /* optical centering */
}

.balance-pill-amount{
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
  font-variant-numeric: tabular-nums;
}

.balance-pill-amount::after{
  content: " ₽";
  margin-left: 4px;
  font-size: inherit;
  font-weight: inherit;
  opacity: 0.98;
  transform: none;
}

.balance-plus-btn{
  width: 20px !important;
  height: 20px !important;
  padding: 4px !important;
  border-radius: 999px !important;
  border: none !important;
  background: #fff !important;
  color: #000 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}

.balance-plus-btn svg{ display: block; }

.balance-plus-btn:hover,
.balance-plus-btn:active,
.balance-plus-btn:focus,
.balance-plus-btn:focus-visible{
  background: #fff !important;
  outline: none !important;
}


.filters-bar button:hover,
.filters-bar button:active,
.filters-bar button:focus,
.filters-bar button:focus-visible {
  
  background: var(--tg-bg-elevated) !important;
  border-color: var(--tg-border-subtle) !important;
  box-shadow: none !important;
  outline: none !important;
}


.top-promo-banner--photo::after {
  display: none !important;
  animation: none !important;
}
.top-promo-banner--photo:active {
  transform: none !important;
}


.gift-card:hover,
.gift-card:active,
.gift-card:focus,
.gift-card:focus-visible {
  background: var(--tg-bg-elevated) !important;
  box-shadow: none !important;
  outline: none !important;
}


.advanced-panel {
  transition: max-height 320ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 320ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 320ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}


.gift-sheet-close,
.modal-close-btn,
.result-sheet-close {
  transition: none !important;
}

@media (max-width: 360px) {
  .top-banner-title { font-size: 14px !important; }
  .boot-loader-title { font-size: 20px !important; }
}

@media (max-width: 520px) {
  .app-shell {
    padding-top: 0px;
  }
}




.gift-card--bought .gift-image,
.gift-card--bought .color-block {
  filter: none !important;
}


.gift-card--bought .gift-image-wrap::after,
.gift-card--unavailable .gift-image-wrap::after {
  content: none !important;
}


.gift-card--bought .gift-card-bought {
  background: rgba(42, 174, 93, 0.30) !important; 
}


.gift-card--bought .gift-buy-btn {
  background: var(--tg-green) !important;
  color: #ffffff !important;
}




@media (max-width: 480px) {
  .top-banner-overlay {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .top-banner-right {
    align-self: center !important;
  }

  
  .top-promo-banner-photo {
    filter: none !important;
  }

  
  .top-banner-ngline {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: rgba(0, 0, 0, 0.22) !important;
  }
}




html.tg-webapp .modal-overlay,
html.tg-webapp .gift-sheet-overlay,
html.tg-webapp .toast,
html.tg-webapp .scroll-top-btn,
html.tg-webapp .top-promo-indicators,
html.tg-webapp .top-promo-deco,
html.tg-webapp .top-promo-sticker,
html.tg-webapp #payment-success-overlay,
html.tg-webapp #payment-fail-overlay,
html.tg-webapp .top-banner-ngline,
html.tg-webapp .gift-card--unavailable .gift-card-unavailable {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}


html.tg-webapp .top-promo-banner::after {
  mix-blend-mode: normal !important;
  opacity: 0.35 !important;
}






.modal-overlay[aria-hidden="true"],
.gift-sheet-overlay[aria-hidden="true"] {
  display: none !important;
}


html.tg-webapp-ios main {
  /*
    iOS Telegram WebView:
    - Keep composited scrolling ON (touch) to avoid large "blank bands" during fast scroll.
    - Remove paint containment which can cause missing tiles / black bands.
  */
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: none !important;
  scroll-behavior: auto !important;
  background: var(--tg-bg) !important;
  contain: none !important;
  transform: none !important;
  will-change: auto !important;
}

html.tg-webapp-ios .top-promo-banner--photo {
  /* avoid creating extra compositor layers inside the scroller */
  transform: none !important;
}




html.tg-webapp-ios .top-promo-banner--photo {
  transform: none !important;
}
html.tg-webapp-ios .top-promo-banner--photo::after {
  animation: none !important;
  opacity: 0.55 !important;
}
html.tg-webapp-ios .top-promo-banner-photo {
  filter: none !important;
  transform: none !important;
}


html.tg-webapp-ios .gift-card--unavailable .gift-image,
html.tg-webapp-ios .gift-sheet--unavailable .gift-sheet-visual {
  filter: none !important;
}


html.tg-webapp-ios .modal {
  transform: translateY(100%) !important;
  will-change: auto !important;
}
html.tg-webapp-ios .modal-overlay.open .modal {
  transform: translateY(0) !important;
}


.top-promo-banner--photo {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}
.top-promo-banner-photo {
  opacity: 0;
  transition: opacity 140ms ease;
}
.top-promo-banner-photo.is-loaded {
  opacity: 1;
}


.filter-label {
  line-height: 1.3;
}
.filter-value {
  line-height: 1.25;
}
.modal-title {
  line-height: 1.25;
}
.modal-item-name {
  line-height: 1.3;
}
.modal-item-sub {
  line-height: 1.45;
}





.modal-overlay,
.gift-sheet-overlay,
.toast,
.scroll-top-btn,
.top-promo-indicators,
.top-promo-deco,
.top-promo-sticker,
#payment-success-overlay,
#payment-fail-overlay,
.top-banner-ngline,
.gift-card-unavailable {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}


.top-promo-banner::after {
  mix-blend-mode: normal !important;
}


.top-promo-banner--photo {
  background: var(--tg-bg-elevated) !important;
}


.gift-card--bought {
  background: var(--tg-bg-elevated) !important;
  border-color: var(--tg-border-subtle) !important;
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
  pointer-events: auto !important;
}


.gift-card--bought .gift-image {
  filter: grayscale(1) saturate(0) contrast(1) brightness(0.95) !important;
  opacity: 0.9 !important;
}


.gift-card--bought .gift-card-bought {
  background: transparent !important;
}


.gift-card-bought-text,
.gift-card--bought .gift-card-bought-text {
  background: var(--tg-green) !important;
  color: #ffffff !important;
}


.gift-card--bought .gift-buy-btn,
.gift-card--bought .gift-buy-btn:hover,
.gift-card--bought .gift-buy-btn:active {
  background: var(--tg-green) !important;
  color: #ffffff !important;
}


.gift-sheet--bought .gift-sheet-tap-hint {
  display: none !important;
}
.gift-sheet--bought .gift-sheet-preview-img {
  filter: grayscale(1) saturate(0) contrast(1) brightness(0.95) !important;
  opacity: 0.9 !important;
}


.gift-sheet-buy-btn.state-bought,
.gift-sheet-buy-btn.state-bought:disabled,
.gift-sheet-buy-btn.state-bought:hover,
.gift-sheet-buy-btn.state-bought:active {
  background: var(--tg-green) !important;
  color: #ffffff !important;
}


.gift-sheet,
.modal,
.modal-list,
.ptr-content,
.result-sheet,
.pay-sheet,
#purchase-cancel-sheet.gift-sheet {
  scrollbar-width: none; 
  -ms-overflow-style: none; 
}
.gift-sheet::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.modal-list::-webkit-scrollbar,
.ptr-content::-webkit-scrollbar,
.result-sheet::-webkit-scrollbar,
.pay-sheet::-webkit-scrollbar,
#purchase-cancel-sheet.gift-sheet::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* iOS Telegram WebView: keep native momentum scroll (otherwise it feels "heavy"),
   but apply light compositing hints to reduce the occasional blank repaint while scrolling. */
html.tg-webapp-ios main {
  -webkit-overflow-scrolling: touch !important;
  scroll-behavior: auto !important;
  will-change: scroll-position;
}

html.tg-webapp-ios #ptr-content {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

/* Fixed containers sometimes trigger repaint artifacts in iOS WebViews.
   Absolute works the same for us (we already lock the viewport height in CSS vars). */
html.tg-webapp-ios .app-shell {
  position: absolute !important;
}

html.tg-webapp-ios .modal-overlay.open,
html.tg-webapp-ios .modal-overlay.closing,
html.tg-webapp-ios .gift-sheet-overlay.visible,
html.tg-webapp-ios .toast.visible {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}


/* ==========================================================================
   UI polish patch (matches reference screenshot)
   - darker Telegram-style background
   - bigger gift previews (less padding + slight zoom)
   - fully rounded price buttons
   - smooth transitions everywhere (no abrupt cut-offs)
   ========================================================================== */

:root {
  --tg-bg: #141414;
  --tg-bg-elevated: #1f1f1f;
  --tg-bg-elevated-soft: #262626;

  --tg-border: rgba(255, 255, 255, 0.10);
  --tg-border-subtle: rgba(255, 255, 255, 0.06);

  --dur-fast: 160ms;
  --dur-med: 240ms;
  --dur-slow: 320ms;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
  background: var(--tg-bg) !important;
}

.app-shell {
  background: var(--tg-bg) !important;
  border-color: var(--tg-border-subtle) !important;
}

main {
  background: var(--tg-bg) !important;
}

.boot-loader {
  background: var(--tg-bg) !important;
}

/* Gift cards: bigger image area, closer to screenshot */
.gift-card {
  background: var(--tg-bg-elevated) !important;
  border-color: var(--tg-border-subtle) !important;
  padding: 8px !important;
  border-radius: 24px !important;
  transition: transform var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out) !important;
}

.gift-card:active {
  transform: scale(0.985) !important;
}

.gift-image-wrap {
  border-radius: 20px !important;
  margin: 0 !important;
}

.gift-image {
  object-fit: contain !important;
  transform: scale(1.12) !important;
  transition: transform var(--dur-med) var(--ease-out) !important;
}

.gift-card:active .gift-image {
  transform: scale(1.16) !important;
}

.gift-info {
  padding: 8px 6px 2px !important;
  gap: 4px !important;
}

.gift-name {
  font-size: 16px !important;
}

.gift-number {
  font-size: 13px !important;
  opacity: 0.75 !important;
}

/* Price buttons: fully rounded like in the screenshot */
.gift-buy-btn {
  border-radius: 999px !important;
  min-height: 40px !important;
  padding: 0 16px !important;
  transition: transform var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    filter var(--dur-fast) var(--ease-out) !important;
}

.gift-buy-btn:active {
  transform: translateY(1px) scale(0.99) !important;
}

/* Bottom buy bar (sheet) */
.gift-sheet-buy-bar {
  border-radius: 999px !important;
}

.gift-sheet-buy-bar .gift-buy-btn {
  border-radius: 999px !important;
}

/* Re-enable smooth interactions (overrides earlier "transition:none !important" blocks) */
.filter-btn,
.filter-pill,
.modal-btn,
.result-btn,
.pay-action,
.modal-close-btn,
.gift-sheet-close,
.result-sheet-close,
.search-clear,
.top-promo-banner--photo {
  transition: transform var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out) !important;
}

.filter-btn:active,
.modal-btn:active,
.result-btn:active,
.pay-action:active,
.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active,
.search-clear:active,
.top-promo-banner--photo:active {
  transform: scale(0.97) !important;
}

/* Restore bought pulse */
.gift-card--bought-anim {
  animation: giftBoughtPulse 900ms var(--ease-out) 1 !important;
}

/* Align sheet transitions (JS uses 320ms close) */
.gift-sheet {
  transition: transform var(--dur-slow) var(--ease-out),
    opacity var(--dur-med) var(--ease-out) !important;
}

.gift-sheet-overlay {
  transition: opacity var(--dur-med) var(--ease-out) !important;
}

/* Slightly tighter padding on small screens -> bigger previews */
@media (max-width: 520px) {
  .gift-card {
    padding: 6px !important;
  }
}

/* =====================================================================
   Patch v3 (2026-01-03)
   - Fix "pixelated/laggy" font rendering across the whole webapp
   - Fix spacing/typography in gift cards (title + #)
   - Remove press/scale imitation on banner + gift cards
   - Make menu open/close animations always smooth & consistent
   ===================================================================== */

:root {
  --ui-menu-ms: 360ms;
}

/* Font rendering: avoid forced grayscale AA that looks "pixelated" in TG WebView */
html,
body {
  -webkit-font-smoothing: antialiased !important;
  text-rendering: optimizeLegibility;
}

body,
input,
button,
textarea,
select {
  -webkit-font-smoothing: antialiased !important;
  text-rendering: optimizeLegibility;
}

html.tg-webapp-ios,
html.tg-webapp-ios body,
html.tg-webapp-ios input,
html.tg-webapp-ios button,
html.tg-webapp-ios textarea,
html.tg-webapp-ios select {
  -webkit-font-smoothing: antialiased !important;
}

/* Ensure aria-hidden doesn't instantly nuke DOM (kills close animation) */
.modal-overlay[aria-hidden="true"],
.gift-sheet-overlay[aria-hidden="true"] {
  display: flex !important;
}

/* Smooth open/close animations for ALL menus/sheets */
.modal-overlay {
  transition: opacity var(--ui-menu-ms) var(--ease-out), visibility 0ms linear var(--ui-menu-ms) !important;
}
.modal-overlay.open,
.modal-overlay.closing {
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}
.modal {
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
}

.gift-sheet-overlay {
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}
.gift-sheet {
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
}

.advanced-panel {
  transition: max-height var(--ui-menu-ms) var(--ease-out),
              opacity var(--ui-menu-ms) var(--ease-out),
              transform var(--ui-menu-ms) var(--ease-out) !important;
}

/* Remove press/scale imitation on banner + cards */
.top-promo-banner--photo {
  transform: none !important;
  will-change: auto !important;
}
.top-promo-banner--photo:active {
  transform: none !important;
}

.gift-card {
  transform: none !important;
}
.gift-card:active {
  transform: none !important;
}

/* Keep big previews, but don't "press-zoom" them */
.gift-image {
  transform: scale(1.12) !important;
}
.gift-card:active .gift-image {
  transform: scale(1.12) !important;
}

/* Card typography + spacing (match reference) */
.gift-info {
  padding: 10px 6px 2px !important;
}

.gift-name {
  /* Slightly smaller + avoid descender clipping in Telegram WebView */
  font-size: 17px !important;
  font-weight: 700 !important;
  line-height: 1.26 !important;
  padding-bottom: 1px !important;
  margin-bottom: 2px !important;
}

.gift-number {
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em !important;
  line-height: 1.24 !important;
  margin-bottom: 8px !important;
  opacity: 0.68 !important;
}



/* =====================================================================
   Patch v4 (2026-01-03)
   - Make filter modals + advanced number search panel always animate smoothly
   - Switch advanced panel animation to grid-rows (no max-height snap)
   - Slightly slower, smoother close/open (matches reference)
   ===================================================================== */

:root {
  --ui-menu-ms: 420ms;
}

/* Modal sheets: explicit states so close never snaps */
.modal {
  transform: translateY(100%) !important;
}
.modal-overlay.open .modal {
  transform: translateY(0) !important;
}
.modal-overlay.closing .modal {
  transform: translateY(100%) !important;
}

/* Advanced panel: animate height + slide (works reliably in TG WebView) */
.advanced-panel {
  /* Override legacy max-height based animation (it caused close to snap instantly) */
  max-height: none !important;
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  will-change: height, opacity, transform;
  pointer-events: none;
  margin-bottom: 0;
  transition: height var(--ui-menu-ms) var(--ease-out),
              opacity var(--ui-menu-ms) var(--ease-out),
              transform var(--ui-menu-ms) var(--ease-out),
              margin-bottom var(--ui-menu-ms) var(--ease-out) !important;
}

.advanced-panel.open {
  max-height: none !important;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  margin-bottom: var(--stack-gap);
}

.advanced-panel.closing {
  max-height: none !important;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  margin-bottom: 0;
}
/* =====================================================================
   Patch v6 (2026-01-03)
   - Fix input text not painting in some Telegram WebViews
   - Force lottie container to composite cleanly (no pre-play blink)
   ===================================================================== */

.search-input {
  -webkit-text-fill-color: currentColor;
}

.gift-sheet-lottie-anim {
  backface-visibility: hidden;
  transform: translateZ(0);
}



/* ──────────────────────────────────────────────────────────────────────────
   Balance UI (RUB)
────────────────────────────────────────────────────────────────────────── */

.balance-widget {
  position: fixed;
  top: calc(0px + 10px);
  right: 12px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.balance-pill:active {
  transform: translateY(1px);
}

.balance-pill-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.10);
  font-size: 13px;
}

.balance-plus {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.balance-plus:active {
  transform: translateY(1px);
}

.balance-modal-body {
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.balance-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.balance-modal-label {
  opacity: 0.85;
  font-size: 13px;
}

.balance-modal-value {
  font-weight: 800;
  font-size: 14px;
}

.balance-modal-input-wrap {
  position: relative;
  width: 100%;
}

.balance-modal-input-wrap .search-input {
  width: 100%;
  padding-left: 14px !important;
  padding-right: 42px !important;
  font-variant-numeric: tabular-nums;
}

.balance-modal-currency {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.75;
  font-weight: 800;
}

.topup-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.chip:active {
  transform: translateY(1px);
}


/* Balance quick amount chips */
.chip--exact {
  border-color: rgba(46, 133, 255, 0.35);
  background: rgba(46, 133, 255, 0.10);
}

.chip.is-selected {
  border-color: rgba(46, 133, 255, 0.70);
  background: rgba(46, 133, 255, 0.18);
}


/* Balance topup chips: selected/exact */
.chip--exact {
  border-color: rgba(46, 133, 255, 0.35);
  background: rgba(46, 133, 255, 0.10);
}

.chip.is-selected {
  border-color: rgba(46, 133, 255, 0.60);
  background: rgba(46, 133, 255, 0.16);
}

.balance-modal-hint {
  opacity: 0.7;
  font-size: 12px;
  line-height: 1.35;
}

/* Top-up flow state inside balance modal */
.topup-state {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
}

.topup-state-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}

.topup-state-sub {
  font-size: 12px;
  opacity: 0.78;
  line-height: 1.35;
}

.topup-state.is-success {
  border-color: rgba(46, 133, 255, 0.35);
  background: rgba(46, 133, 255, 0.10);
}

.topup-state.is-failed {
  border-color: rgba(255, 80, 80, 0.25);
  background: rgba(255, 80, 80, 0.08);
}

/* ───────────────────────────────────────────────────────────────────────
   v14 UI fixes (pixel-match / no festive overlays)
   ─────────────────────────────────────────────────────────────────────── */

/* Top bar so the balance pill sits ABOVE the banner (not on top of it) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1200;
  padding: calc(0px + 10px) 0 10px;
  background: #141414;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Telegram-like balance pill */
.balance-widget {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  display: flex;
  width: 100%;
  justify-content: flex-end;
  align-items: center;
  gap: 0;
  pointer-events: auto;
}

.balance-pill {
  background: #1f2126 !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  border-right: 0 !important;
  border-radius: 999px 0 0 999px !important;
  padding: 8px 12px !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}

.balance-pill-icon {
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px !important;
  background: rgba(46, 133, 255, 0.95) !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.balance-pill-amount {
  font-size: 14px !important;
  font-weight: 800 !important;
}

.balance-plus {
  width: 34px !important;
  height: 34px !important;
  margin-left: 0 !important;
  background: #ffffff !important;
  color: #111 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-left: 0 !important;
  border-radius: 0 999px 999px 0 !important;
  box-shadow: none !important;
}

/* Compact bottom-sheet modal for balance / topup */
.modal--compact {
  height: auto !important;
  max-height: min(72dvh, 520px) !important;
}

/* Insufficient funds message inside topup modal */
.balance-shortage {
  border: 1px solid rgba(255, 91, 91, 0.35);
  background: rgba(255, 91, 91, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
}

.balance-shortage-title {
  font-size: 14px;
  font-weight: 900;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.balance-shortage-sub {
  margin-top: 4px;
  opacity: 0.85;
  font-size: 12px;
  line-height: 1.25;
}

/* ───────────────────────────────────────────────────────────────────────
   v16: Match Telegram wallet-like balance pill (1:1 like ref screenshot)
   - No bar background, only spacing above banner
   - Dark pill container with inner white + circle
   ─────────────────────────────────────────────────────────────────────── */

.topbar {
  background: transparent !important;
  border-bottom: 0 !important;
  padding: calc(0px + 8px) 0 8px !important;
}

.balance-widget {
  width: fit-content !important;
  justify-content: flex-end !important;
  margin-left: auto !important;
  margin-right: 12px !important;
  padding: 5px 6px !important;
  gap: 10px !important;
  border-radius: 999px !important;
  background: rgba(15, 16, 18, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 10px 22px rgba(0,0,0,0.35) !important;
}

.balance-pill {
  background: transparent !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 0 !important;
  gap: 8px !important;
}

.balance-pill-icon {
  width: 24px !important;
  height: 24px !important;
  border-radius: 999px !important;
  background: rgba(46, 133, 255, 0.95) !important;
  font-size: 12px !important;
}

.balance-plus {
  width: 26px !important;
  height: 26px !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  color: #111 !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* =====================================================================
   Patch v17 (2026-01-04)
   - Balance widget: remove fixed positioning, reduce jank
   - Topup/balance modal: clean layout, remove YooMoney labels, crisp typography
   - Close buttons: one consistent круглой крестик across the app
   - Remove heavy backdrop blur (laggy in Telegram WebView)
   ===================================================================== */

:root {
  /* 420ms felt "laggy"; 260-300ms is closer to Telegram native sheets */
  --ui-menu-ms: 280ms;
}

/* Telegram WebView: backdrop-filter is expensive and causes jank */
.modal-overlay.open,
.modal-overlay.closing,
.gift-sheet-overlay.visible {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Header alignment (title + close should be centered, not "криво") */
.modal-header {
  align-items: center !important;
}

/* Make action buttons pill-shaped */
.modal-btn {
  border-radius: 999px !important;
  letter-spacing: 0.01em;
}

/* Balance widget should live in topbar (not fixed to viewport) */
.balance-widget {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
}

/* Balance pill polish (spacing + less heavy shadows) */
.balance-widget {
  align-items: center !important;
  gap: 8px !important;
  padding: 4px 6px !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.28) !important;
}

.balance-pill {
  align-items: center !important;
}

.balance-pill-icon {
  font-weight: 700 !important; /* avoid ugly synthetic 900 glyph on some devices */
}

.balance-plus {
  width: 30px !important;
  height: 30px !important;
}

/* Balance/topup modal: numerals look better with tabular nums */
.balance-pill-amount,
.balance-modal-value,
.balance-modal-currency,
#topup-amount-input {
  font-variant-numeric: tabular-nums;
}

.balance-modal-value {
  font-weight: 700;
  font-size: 15px;
}

.balance-modal-currency {
  font-size: 16px;
  font-weight: 700;
}

/* Close buttons: same crisp "X" everywhere, WITHOUT a visible circle */
.modal-close-btn,
.gift-sheet-close,
.result-sheet-close {
  width: 44px !important;
  height: 44px !important;
  border: none !important;
  background: transparent !important;
  color: #ffffff !important;
  font-size: 0 !important; /* hide the text glyph (✕/×) so it never looks pixelated */
  line-height: 1 !important;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}

.modal-close-btn:hover,
.gift-sheet-close:hover,
.result-sheet-close:hover {
  background: transparent !important;
}

.modal-close-btn::before,
.modal-close-btn::after,
.gift-sheet-close::before,
.gift-sheet-close::after,
.result-sheet-close::before,
.result-sheet-close::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transform-origin: center;
}

.modal-close-btn::before,
.gift-sheet-close::before,
.result-sheet-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.modal-close-btn::after,
.gift-sheet-close::after,
.result-sheet-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Modal overlay blur can combine with fixed elements to cause stutter */
.modal-overlay {
  background: rgba(0, 0, 0, 0.60);
}

/* Filter modals: match reference (lighter bg, tighter scale, no dark bottom strip) */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal {
  background: #26282c !important;
}

#collections-modal .modal-header,
#models-modal .modal-header,
#backdrops-modal .modal-header {
  padding: 16px 18px 8px !important;
}

#collections-modal .modal-search,
#models-modal .modal-search,
#backdrops-modal .modal-search {
  padding: 0 18px 8px !important;
}

#collections-modal .modal-search .search-input,
#models-modal .modal-search .search-input,
#backdrops-modal .modal-search .search-input {
  height: 44px !important;
  border-radius: 14px !important;
  /* Do NOT use background shorthand here: it resets the loupe background-image */
  background-color: rgba(255, 255, 255, 0.05) !important;
}

#collections-modal .modal-item,
#models-modal .modal-item,
#backdrops-modal .modal-item {
  padding: 12px 18px !important;
  min-height: 68px !important;
}

#collections-modal .item-icon,
#models-modal .item-icon,
#backdrops-modal .item-icon {
  width: 42px !important;
  height: 42px !important;
  margin-right: 14px !important;
}

#collections-modal .item-name,
#models-modal .item-name,
#backdrops-modal .item-name {
  font-size: 16px !important;
}

#collections-modal .price-value-modal,
#models-modal .price-value-modal,
#backdrops-modal .price-value-modal {
  font-size: 17px !important;
}

#collections-modal .modal-footer,
#models-modal .modal-footer,
#backdrops-modal .modal-footer {
  border-top: none !important;
  padding: 14px 18px calc(14px + 0px) !important;
  background: transparent !important;
}

/* Make filter footer buttons more "square" like the reference (keep labels/colors) */
#collections-modal .modal-btn,
#models-modal .modal-btn,
#backdrops-modal .modal-btn {
  border-radius: 14px !important;
  height: 54px !important;
}


/* =====================================================================
   Patch v19 (2026-01-04)
   Требования по скринам:
   - Фоны 1:1
     (2) фон приложения: #141414
     (3) фон карточек/фильтров/инпутов/меню: #282727
     (4) фон кнопок внутри меню ("Очистить"): #3A3A3A
     (5) фон синих кнопок: #1689FF
   - Убрать круговую маску у элементов в меню фильтров
   - Вернуть лупу в инпутах поиска в меню коллекций/моделей/фонов
   - Сделать анимации заметно длиннее и плавнее
   - Исправить "увеличенный верх" в меню подарка (крестик не должен ломать поток)
   ===================================================================== */

:root {
  /* Swatches */
  --tg-bg: #141414;
  --tg-bg-elevated: #282727;
  --tg-bg-elevated-soft: #2f2e2e;
  --tg-accent: #1689ff;
  --tg-accent-soft: rgba(22, 137, 255, 0.16);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 420ms var(--ease-out);
  --transition-slow: 650ms var(--ease-out);
  --ui-menu-ms: 650ms;
}

html,
body,
.app-shell,
main {
  background: var(--tg-bg) !important;
}

/* Cards / filter buttons / inputs */
.gift-card,
.filter-btn,
.search-input,
.advanced-panel,
.modal,
.gift-sheet,
.gift-sheet-traits {
  background: var(--tg-bg-elevated) !important;
}

/* Modal sheet backgrounds (collections/models/backdrops) */
/* Fix: collections/models/backdrops search field should be slightly elevated,
   not identical to the sheet background (prevents "black" look on first paint). */
#collections-modal .modal-search .search-input,
#models-modal .modal-search .search-input,
#backdrops-modal .modal-search .search-input {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
}

#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal {
  background: var(--tg-bg-elevated) !important;
}

/* Gift menu (sheet) */
.gift-sheet {
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.55) !important;
}

/* Fix: close button must be absolute, иначе он увеличивает "верх" */
.gift-sheet-close {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  left: auto !important;
  margin: 0 !important;
}

/* Crisp X everywhere, but do NOT break positioning */
.modal-close-btn,
.gift-sheet-close,
.result-sheet-close {
  background: transparent !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 0 !important;
  position: relative !important;
}

/* Important: the gift sheet close must stay ABSOLUTE (otherwise it увеличивает верх) */
.gift-sheet-close {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  left: auto !important;
}

.modal-close-btn::before,
.modal-close-btn::after,
.gift-sheet-close::before,
.gift-sheet-close::after,
.result-sheet-close::before,
.result-sheet-close::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transform-origin: center;
}
.modal-close-btn::before,
.gift-sheet-close::before,
.result-sheet-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.modal-close-btn::after,
.gift-sheet-close::after,
.result-sheet-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Filter modal search inputs: keep the loupe (previous patch убил background-image) */
#collections-modal .modal-search .search-input,
#models-modal .modal-search .search-input,
#backdrops-modal .modal-search .search-input {
  background-color: var(--tg-bg-elevated) !important;
  border: 1px solid var(--tg-border-subtle) !important;
  padding-left: 40px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='6' stroke='rgba(148,155,164,1)' stroke-width='2' fill='none'/%3E%3Cline x1='15' y1='15' x2='20' y2='20' stroke='rgba(148,155,164,1)' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 14px center !important;
  background-size: 16px 16px !important;
}

/* Remove circle crop in filter lists */
.item-icon-backdrop {
  border-radius: 14px !important;
  overflow: hidden !important;
}

/* Gift traits grid backgrounds */
.gift-sheet-traits {
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.gift-sheet-trait-label {
  background: #3a3a3a !important;
}

/* Buttons inside menus ("Очистить" / ghost) */
.modal-btn.ghost {
  background: #3a3a3a !important;
  color: #ffffff !important;
}

/* Primary / blue buttons */
.modal-btn.primary,
.gift-sheet-buy-bar,
.buy-btn,
.gift-buy-btn {
  background: var(--tg-accent) !important;
}

/* Hover/active keep same tone to match screenshots */
.gift-sheet-buy-bar:hover,
.modal-btn.primary:hover,
.buy-btn:hover,
.gift-buy-btn:hover {
  background: var(--tg-accent) !important;
}

/* Balance widget restyle (last screenshot) */
.balance-widget {
  width: fit-content !important;
  margin-left: auto !important;
  margin-right: 12px !important;
  padding: 0 !important;
  gap: 8px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.balance-pill {
  height: 34px !important;
  padding: 0 12px !important;
  border-radius: 14px !important;
  background: var(--tg-bg-elevated) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

.balance-pill-icon {
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px !important;
  background: var(--tg-accent) !important;
  color: #fff !important;
  font-weight: 800 !important;
}

.balance-plus {
  width: 34px !important;
  height: 34px !important;
  border-radius: 14px !important;
  background: var(--tg-accent) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: none !important;
}

/* Animations: longer + smoother everywhere */
.modal-overlay {
  transition: opacity var(--transition-slow), visibility 0ms linear var(--ui-menu-ms) !important;
}
.modal {
  transition: transform var(--transition-slow) !important;
}
.gift-sheet-overlay {
  transition: opacity var(--transition-slow) !important;
}
.gift-sheet {
  transition: transform var(--transition-slow) !important;
}

.filter-btn,
.gift-card,
.search-clear,
.modal-btn,
.gift-sheet-buy-bar,
.balance-pill,
.balance-plus {
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast) !important;
}



/* =====================================================================
   Patch v20 (2026-01-04)
   - Fix janky menu animations (faster, smoother, no leftover shadow)
   - Balance widget as ONE button (amount + plus)
   - Balance modal layout more rational
   - "Продано" / sold buttons must be grey (cards + sheet)
   - Advanced search panel height clip fix
   ===================================================================== */

:root {
  /* Slightly faster than default, but still smooth */
  --ui-menu-ms: 240ms;
  --transition-fast: 160ms;
  --transition-slow: 240ms;
  --ease-out: cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* --------------------
   Modal animations
--------------------- */
.modal-overlay,
.gift-sheet-overlay,
.result-sheet-overlay {
  background: rgba(0, 0, 0, 0.62) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}

.modal-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.modal-overlay.open,
.modal-overlay.closing {
  visibility: visible;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-overlay.closing {
  opacity: 0;
  pointer-events: none;
}
.modal-overlay[aria-hidden="true"] {
  visibility: hidden !important;
}

.modal {
  will-change: transform, opacity;
  transition: transform var(--ui-menu-ms) var(--ease-out), opacity 180ms var(--ease-out) !important;
  transform: translateY(100%);
  opacity: 0;
}
.modal-overlay.open .modal {
  transform: translateY(0);
  opacity: 1;
}
.modal-overlay.closing .modal,
.modal-overlay[aria-hidden="true"] .modal {
  transform: translateY(100%);
  opacity: 0;
}

.gift-sheet-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.gift-sheet-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.gift-sheet-overlay[aria-hidden="true"] {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.gift-sheet {
  will-change: transform, opacity;
  transition: transform var(--ui-menu-ms) var(--ease-out), opacity 180ms var(--ease-out) !important;
  transform: translateY(100%);
  opacity: 0;
}
.gift-sheet-overlay.visible .gift-sheet {
  transform: translateY(0);
  opacity: 1;
}

/* Keep other UI micro-animations snappy */
.filter-btn,
.gift-card,
.modal-btn,
.buy-btn,
.gift-buy-btn,
.balance-pill {
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast) !important;
}

/* --------------------
   Advanced panel clip fix
--------------------- */
.advanced-panel {
  overflow: hidden;
}
.advanced-panel.open {
  overflow: visible !important;
}

/* --------------------
   Sold / bought button colors
--------------------- */
.gift-card--unavailable .gift-buy-btn,
.gift-card--unavailable .gift-buy-btn:hover,
.gift-card--unavailable .gift-buy-btn:active,
.gift-card--unavailable .gift-buy-btn:disabled {
  background: #3a3a3a !important;
  color: #ffffff !important;
}

.gift-card--bought .gift-buy-btn,
.gift-card--bought .gift-buy-btn:hover,
.gift-card--bought .gift-buy-btn:active,
.gift-card--bought .gift-buy-btn:disabled,
.gift-card--locked .gift-buy-btn,
.gift-card--locked .gift-buy-btn:hover,
.gift-card--locked .gift-buy-btn:active,
.gift-card--locked .gift-buy-btn:disabled {
  background: var(--tg-green) !important;
  color: #ffffff !important;
}

/* Gift sheet buy bar states */
.gift-sheet-buy-bar[data-state="sold"],
.gift-sheet-buy-bar[data-state="sold"]:hover,
.gift-sheet-buy-bar[data-state="sold"]:active,
.gift-sheet--unavailable .gift-sheet-buy-bar,
.gift-sheet--unavailable .gift-sheet-buy-bar:hover,
.gift-sheet--unavailable .gift-sheet-buy-bar:active {
  background: #3a3a3a !important;
  color: #ffffff !important;
}

.gift-sheet-buy-bar[data-state="paid_wait"],
.gift-sheet-buy-bar[data-state="delivering"],
.gift-sheet-buy-bar[data-state="bought"] {
  background: var(--tg-green) !important;
}

.gift-sheet-buy-bar[data-state="paid_wait"]:hover,
.gift-sheet-buy-bar[data-state="delivering"]:hover,
.gift-sheet-buy-bar[data-state="bought"]:hover {
  background: #00b86c !important;
}

/* --------------------
   Balance widget: amount + separate “+” button
--------------------- */
.balance-widget {
  width: fit-content !important;
  justify-content: flex-end !important;
  padding: 0 !important;
  gap: 8px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.balance-pill.balance-pill--single {
  height: 36px !important;
  padding: 0 10px !important;
  border-radius: 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  background: var(--tg-bg-elevated) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

.balance-pill-icon {
  width: 24px !important;
  height: 24px !important;
  border-radius: 10px !important;
  background: var(--tg-accent) !important;
  color: #ffffff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 900 !important;
}

.balance-pill-amount {
  font-size: 14px !important;
  font-weight: 900 !important;
  font-variant-numeric: tabular-nums;
}

.balance-plus-btn {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: var(--tg-bg-elevated);
  color: #ffffff;
  font-weight: 900;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.balance-plus-btn:active {
  transform: scale(0.98);
}

.balance-plus-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}


/* --------------------
   Balance modal redesign
--------------------- */
.balance-modal-body {
  padding: 14px 16px 12px !important;
  gap: 14px !important;
}

.balance-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.balance-summary-label {
  opacity: 0.8;
  font-size: 13px;
}

.balance-summary-value {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}

.topup-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topup-label {
  opacity: 0.85;
  font-size: 13px;
}

.balance-modal-input-wrap .search-input {
  height: 46px !important;
  border-radius: 16px !important;
  background: var(--tg-bg-elevated) !important;
}

.topup-chips {
  gap: 10px !important;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  background: #3a3a3a !important;
}

.chip.is-selected,
.chip--exact.is-selected {
  border-color: rgba(22, 137, 255, 0.75) !important;
  background: rgba(22, 137, 255, 0.22) !important;
}

.balance-shortage {
  border: 1px solid rgba(255, 91, 91, 0.35) !important;
  background: rgba(255, 91, 91, 0.08) !important;
  border-radius: 16px !important;
  padding: 12px 14px !important;
}

.balance-shortage-title {
  font-size: 14px !important;
  font-weight: 900 !important;
}

.balance-shortage-sub {
  margin-top: 6px !important;
  opacity: 0.85 !important;
  font-size: 12px !important;
}

/* =====================================================================
   Patch v21 (QA)
   - Remove heavy shadows that оставляют "след" во время анимаций
   - Fix advanced search input clipping (no translate during expand)
   - Make disabled buttons obvious (helps when submit is disabled)
   ===================================================================== */

.modal,
.gift-sheet,
.result-sheet,
.pay-sheet {
  box-shadow: none !important;
}

.advanced-panel {
  transform: none !important;
}

.advanced-panel.open {
  transform: none !important;
  max-height: 96px !important;
}

.modal-btn:disabled,
.gift-sheet-buy-bar:disabled,
.buy-btn:disabled,
.gift-buy-btn:disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
}



/* --------------------------------------------------------------------------
   v22 UI fixes: smooth animations, payment UX, fonts
   -------------------------------------------------------------------------- */

/* 1) Hidden modals must not render (fixes stray square/close button artifacts) */
.modal-overlay[aria-hidden="true"] { display: none !important; }

/* 2) Remove native webkit search cancel button (it looks like a square X in some WebViews) */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration { display: none; }

/* 3) Consistent font stack everywhere */
button, input, textarea, select { font-family: var(--font-sans); }

/* 4) Smoother, consistent motion */
:root {
  --ui-menu-ms: 280ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay { transition: opacity var(--ui-menu-ms) var(--ease-out), visibility var(--ui-menu-ms) var(--ease-out); }
.modal { transition: transform var(--ui-menu-ms) var(--ease-out); will-change: transform; }
.advanced-panel { transition: max-height var(--ui-menu-ms) var(--ease-out), opacity var(--ui-menu-ms) var(--ease-out), transform var(--ui-menu-ms) var(--ease-out); will-change: transform, opacity; }
.gift-sheet, .result-sheet { transition: transform var(--ui-menu-ms) var(--ease-out), opacity var(--ui-menu-ms) var(--ease-out); will-change: transform, opacity; }

/* 5) Balance modal footer: match project design + allow new link */
.modal-footer.balance-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-btn.secondary {
  background: transparent;
  border: 1px solid var(--tg-border);
  color: var(--tg-text);
}
.modal-btn.secondary:active { transform: translateY(1px); }

/* 6) Top-up state card header + action */
.topup-state-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topup-mini-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--tg-border);
  background: transparent;
  color: var(--tg-text);
  font-size: 13px;
  font-weight: 600;
}
.topup-mini-btn:active { transform: translateY(1px); }

/* 7) Close buttons: no chunky squares */
.modal-close-btn, .gift-sheet-close, .result-sheet-close {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}


/* 8) Advanced panel: smooth slide (override v21 no-translate patch) */
.advanced-panel { transform: translateY(-4px) !important; }
.advanced-panel.open { transform: translateY(0) !important; }



/* v22.1 final patch
   - Fix custom clear button icon (instead of blank / square native X)
   - Make menu animations GPU-friendly and consistent
   - Prefer Canvas renderer for Lottie (handled in JS)
*/

/* Clear button (our own) */
.advanced-search .search-clear{
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 999px !important;
  border: none !important;
  background: rgba(255,255,255,0.08) !important;
  color: transparent !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity var(--ui-menu-ms, 260ms) var(--ease-out, ease-out), background-color 160ms ease-out !important;
}

.advanced-search .search-clear::before{
  content: "" !important;
  width: 12px !important;
  height: 12px !important;
  display: block !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 12px 12px !important;
  opacity: 0.92 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 6L6 18' stroke='rgba(242,243,245,0.92)' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M6 6l12 12' stroke='rgba(242,243,245,0.92)' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.advanced-search .search-clear.visible{
  opacity: 1 !important;
  pointer-events: auto !important;
}

.advanced-search .search-clear:active{
  background: rgba(255,255,255,0.12) !important;
}

/* Consistent motion timing */
:root{
  --ui-menu-ms: 280ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Overwrite older patches that disabled/changed motion */
.modal-overlay,
.gift-sheet-overlay,
.result-sheet-overlay{
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}

.modal{
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
  transform: translate3d(0, 100%, 0) !important;
  will-change: transform;
  opacity: 1 !important; /* avoid blink */
}
.modal-overlay.open .modal{ transform: translate3d(0, 0, 0) !important; }
.modal-overlay.closing .modal{ transform: translate3d(0, 100%, 0) !important; }

/* Sheets: always GPU translate3d */
.gift-sheet,
.result-sheet,
.pay-sheet{
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
  transform: translate3d(0, 100%, 0) !important;
  will-change: transform;
  opacity: 1 !important;
}
.gift-sheet.open,
.result-sheet.open,
.pay-sheet.open{
  transform: translate3d(0, 0, 0) !important;
}


/* --------------------
   Quick top-up menu (+) and Tonkeeper confirm overlay
--------------------- */

/* Prevent layout shift when overlay opens */
html.overlay-open,
html.overlay-open body {
  overflow: hidden !important;
  /* Prevent width change - scrollbar is already hidden via scrollbar-width: none */
}

.tonkeeper-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  height: var(--tg-viewport-height, var(--app-height, 100vh));
  display: flex;
  align-items: center;
  justify-content: center;


  padding: 0px 0 0px 0;
  box-sizing: border-box;
  background: transparent;

  opacity: 0;
  /* Allow the UI behind to remain interactive; only the card is clickable */
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 1500;
}

.tonkeeper-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.tonkeeper-sheet {
  position: relative;
  width: min(340px, calc(100% - 44px));
  background: #141414;
  border-radius: 22px;
  padding: 18px 18px 22px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  overflow: hidden;
}

.tonkeeper-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.72);
  font-size: 28px;
  line-height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}

.tonkeeper-close:hover {
  color: rgba(255,255,255,0.92);
}

.tonkeeper-icon {
  width: 120px;
  height: 82px;
  margin: 12px auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Purse animation container (референс: розовая сумка) */
.tonkeeper-purse {
  width: 168px;
  height: 128px;
  margin: 6px auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.tonkeeper-purse > * {
  width: 100% !important;
  height: 100% !important;
}

.tonkeeper-title {
  font-size: 22px;
  font-weight: 800;
  margin: 8px 0 14px;
  text-align: center;
}

.tonkeeper-subtitle {
  font-size: 14px;
  opacity: 0.78;
  line-height: 1.25;
  margin-top: 6px;
  text-align: center;
}

.tonkeeper-input-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}


.tonkeeper-input {
  width: min(280px, 100%);
  height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 18px;
  padding: 0 14px;
  outline: none;
}
.tonkeeper-input:focus {
  border-color: rgba(255,255,255,0.22);
}


.tonkeeper-input::placeholder {
  color: rgba(255,255,255,0.35);
}

.tonkeeper-input.is-invalid {
  border-color: rgba(255, 78, 78, 0.85);
  box-shadow: 0 0 0 2px rgba(255, 78, 78, 0.18);
}

.tonkeeper-btn {
  width: min(280px, 100%);
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: #2f80ff;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.tonkeeper-btn:disabled { opacity: 0.6; cursor: default; }


.tonkeeper-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.tonkeeper-sheet--confirm {
  padding: 18px 16px 22px;
}

.confirm-spinner{
  width: 74px;
  height: 74px;
  margin: 8px auto 10px;
  border-radius: 50%;
  border: 6px solid rgba(255,255,255,0.14);
  border-top-color: rgba(255,255,255,0.52);
  animation: confirmSpin 0.9s linear infinite;
}
@keyframes confirmSpin{ to{ transform: rotate(360deg);} }

/* Invalid state (used instead of toast notifications) */
.topup-amount-input.is-invalid {
  border-color: rgba(255, 78, 78, 0.85) !important;
  box-shadow: 0 0 0 2px rgba(255, 78, 78, 0.18) !important;
}


/* --------------------
   UI fixes (v18)
   1) Balance widget: keep it fixed in one place and visually merge pill + plus.
   2) Quick top-up: compact shortage block.
--------------------- */

/* Keep the balance controls glued to the viewport (Telegram WebView can make sticky headers feel "floaty"). */
.balance-widget {
  position: fixed !important;
  top: calc(0px + 10px) !important;
  right: 12px !important;
  z-index: 1700 !important;

  /* Single combined dock */
  padding: 4px !important;
  gap: 4px !important;
  border-radius: 18px !important;
  background: rgba(20, 20, 20, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Inner pill becomes part of the dock (no own card background). */
.balance-pill {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 6px 10px !important;
  border-radius: 14px !important;
}

/* Plus button matches the dock and doesn't "wander" due to mismatched selector versions. */
.balance-plus-btn {
  width: 34px !important;
  height: 34px !important;
  border-radius: 14px !important;
  border: 0 !important;
  background: rgba(255, 255, 255, 0.10) !important;
}
.balance-plus-btn:hover {
  background: rgba(255, 255, 255, 0.14) !important;
}

/* When the compact top-up sheet is opened from a buy attempt, show the shortage block nicely. */
.balance-shortage--compact {
  margin: 4px auto 10px;
  width: min(280px, 100%);
  padding: 10px 12px;
  border-radius: 14px;
}
.balance-shortage--compact .balance-shortage-title {
  font-size: 14px;
}
.balance-shortage--compact .balance-shortage-sub {
  font-size: 12px;
}

/* =====================================================================
   Patch v21 (2026-01-05)
   - Top bar must NOT be sticky: it should stay above banner and scroll away
   - Quick top-up (+) sheet: new Telegram-like bottom-sheet design
   - Payment overlays: dim + subtle blur
   ===================================================================== */

/* 1) Topbar should behave like part of the page, not a sticky header */
.topbar {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
  padding: calc(0px + 8px) 12px 10px !important;
  background: transparent !important;
  border-bottom: 0 !important;
}

/* Keep the balance pill group aligned with the banner width */
.balance-widget {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  z-index: auto !important;
  transform: none !important;
  margin: 0 0 10px auto !important;
}

/* 2) Quick top-up (+) overlay becomes a bottom sheet */
.tonkeeper-overlay {
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 12px calc(12px + 0px) !important;
  background: rgba(0, 0, 0, 0.62) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tonkeeper-sheet {
  width: min(520px, 100%) !important;
  border-radius: 24px 24px 18px 18px !important;
  padding: 14px 16px 18px !important;
  background: #141414 !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.55) !important;
}

.tonkeeper-drag-handle {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 2px auto 10px;
}

.tonkeeper-close {
  top: 10px !important;
  right: 12px !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 999px !important;
  font-size: 22px !important;
  line-height: 22px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255,255,255,0.86) !important;
}

.tonkeeper-title {
  margin: 6px 0 12px !important;
  font-size: 20px !important;
  font-weight: 800 !important;
}

.tonkeeper-purse {
  width: 132px !important;
  height: 104px !important;
  margin: 0 auto 2px !important;
}

/* Shortage block: tidy, no weird right-aligned amount */
.tonkeeper-sheet .balance-shortage--compact {
  width: 100% !important;
  margin: 0 0 12px !important;
  padding: 12px 12px !important;
  border-radius: 16px !important;
}
.tonkeeper-sheet .balance-shortage-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.tonkeeper-sheet .balance-shortage-head {
  font-weight: 900;
}
.tonkeeper-sheet .balance-shortage-need {
  font-weight: 800;
}

.tonkeeper-input-wrap {
  width: 100% !important;
  align-items: stretch !important;
}

.tonkeeper-field {
  position: relative;
  width: 100%;
}

.tonkeeper-input {
  width: 100% !important;
  height: 46px !important;
  border-radius: 16px !important;
  font-size: 17px !important;
  padding: 0 44px 0 14px !important;
}

.tonkeeper-currency {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  color: rgba(255,255,255,0.75);
  pointer-events: none;
}

.tonkeeper-btn {
  width: 100% !important;
  height: 48px !important;
  border-radius: 16px !important;
  margin-top: 12px;
}

/* Confirm sheet is slightly more compact */
.tonkeeper-sheet--confirm {
  padding: 14px 16px 18px !important;
}


/* =====================================================================
   Patch v22 (2026-01-05)
   Требования по скринам:
   - Минимальная сумма пополнения: 25 ₽ (логика в JS)
   - Quick top-up sheet:
     * поле ввода не "толстое" + фон поля как у карточек (#282727)
     * анимация сумки заметнее
     * крестик без круга и как в остальных меню
     * убрать серую полоску (drag handle)
   - Balance widget: привести к виду как на TON-пиле (белая капсула, ровные отступы)
   - Shortage block: сделать аккуратный callout (без "ужасного" красного бокса)
   ===================================================================== */

/* 1) Remove grey drag handle in top-up/confirm sheets */
.tonkeeper-drag-handle {
  display: none !important;
}

/* 2) Close button: same crisp X as everywhere, no circle */
.tonkeeper-close {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  color: #ffffff !important;
  font-size: 0 !important; /* hide × char */
  width: 34px !important;
  height: 34px !important;
  top: 12px !important;
  right: 12px !important;
  position: absolute !important;
}
.tonkeeper-close::before,
.tonkeeper-close::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transform-origin: center;
}
.tonkeeper-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.tonkeeper-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* 3) Purse animation: slightly bigger */
.tonkeeper-purse {
  width: 176px !important;
  height: 134px !important;
  margin: 4px auto 6px !important;
}

/* 4) Input: thinner + correct background (#282727) */
.tonkeeper-input {
  height: 40px !important;
  border-radius: 14px !important;
  font-size: 16px !important;
  background: var(--tg-bg-elevated) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  padding: 0 42px 0 14px !important;
}
.tonkeeper-btn {
  height: 46px !important;
  border-radius: 14px !important;
}

/* 5) Shortage: tidy callout */
.balance-shortage {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border-radius: 16px !important;
  padding: 12px 12px 12px 46px !important;
}
.balance-shortage::before {
  content: "!";
  position: absolute;
  left: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: rgba(255, 92, 92, 0.95);
  background: rgba(255, 92, 92, 0.14);
}
.balance-shortage-title {
  font-size: 13px !important;
  font-weight: 900 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 2px !important;
}
.balance-shortage-sub {
  margin-top: 6px !important;
  font-size: 12px !important;
  opacity: 0.72 !important;
}

/* 6) Balance widget: match TON pill style (white capsule, ровные отступы) */
.topbar {
  display: flex !important;
  justify-content: flex-end !important;
}

.balance-widget {
  width: fit-content !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 3px 4px !important;
  border-radius: 18px !important;
  background: #f3f4f5 !important;
  border: 1px solid rgba(0, 0, 0, 0.10) !important;
}

.balance-pill.balance-pill--single {
  background: transparent !important;
  border: 0 !important;
  height: 30px !important;
  padding: 0 8px !important;
  border-radius: 14px !important;
  gap: 8px !important;
}

.balance-pill-icon {
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 900 !important;
}

.balance-pill-amount {
  color: #111111 !important;
  font-weight: 900 !important;
}

.balance-plus-btn {
  width: 28px !important;
  height: 28px !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.14) !important;
  color: #111111 !important;
  font-size: 18px !important;
  font-weight: 900 !important;
}
.balance-plus-btn:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

/* =====================================================================
   Patch v24 (2026-01-05)
   - Payment menus: same palette as other menus + slide-up from bottom
   - Smoothen motion
   - Top bar spacing + dark balance pill (project is grey/black)
   - Shortage: minimal text, red "Недостаточно средств", no balance line
   ===================================================================== */

:root{
  /* a bit slower and smoother than v21 */
  --ui-menu-ms: 360ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Make Tonkeeper overlays behave like other bottom sheets */
.tonkeeper-overlay{
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 12px calc(12px + 0px) !important;
  background: rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}
.tonkeeper-overlay.visible{
  opacity: 1;
  pointer-events: auto;
}

.tonkeeper-sheet{
  width: min(520px, 100%) !important;
  max-width: 520px !important;
  border-radius: 26px 26px 0 0 !important;
  background: #1f2124 !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.55) !important;
  padding: 14px 16px calc(18px + 0px) !important;
  margin: 0 auto !important;

  transform: translate3d(0, 110%, 0);
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform;
}
.tonkeeper-overlay.visible .tonkeeper-sheet{
  transform: translate3d(0, 0, 0);
}

/* Remove the drag handle completely (we don't use it anywhere in the project) */
.tonkeeper-drag-handle{ display: none !important; }

/* Close button: same as other menus (no circle) */
.tonkeeper-close{
  width: 42px !important;
  height: 42px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: transparent !important;
  font-size: 0 !important;
}
.tonkeeper-close::before,
.tonkeeper-close::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,0.92);
  border-radius: 2px;
  transform-origin: center;
}
.tonkeeper-close::before{ transform: translate(-50%, -50%) rotate(45deg); }
.tonkeeper-close::after{  transform: translate(-50%, -50%) rotate(-45deg); }

/* Purse animation: keep size but align with the sheet */
.tonkeeper-purse{
  width: 156px !important;
  height: 120px !important;
  margin: 2px auto 6px !important;
}

/* Shortage: minimal & readable */
.balance-shortage{
  padding: 12px !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
}
.balance-shortage::before{ content: none !important; display: none !important; }
.balance-shortage-title{
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}
.balance-shortage-head{
  color: var(--tg-red) !important;
  font-weight: 900 !important;
}
.balance-shortage-need{ font-weight: 900 !important; }
.balance-shortage-sub{ display: none !important; }

/* Topbar spacing: make top/bottom paddings feel balanced */
.topbar{
  display: flex !important;
  justify-content: flex-end !important;
  /* Make top gap ~= gap to the banner (banner has its own margin-top) */
  padding: calc(0px + 12px) 12px 8px !important;
}

/* Balance pill: dark like the rest of the app (no white capsule) */
.balance-widget{
  width: fit-content !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 6px !important;
  margin: 0 0 0 auto !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.balance-pill-amount{ color: var(--tg-text) !important; }
.balance-plus-btn{
  width: 32px !important;
  height: 32px !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.10) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  color: var(--tg-text) !important;
}
.balance-plus-btn:hover{ background: rgba(255, 255, 255, 0.14) !important; }

/* Smoothen “sharp” fades/opens across the UI */
.modal-overlay,
.gift-sheet-overlay,
.tonkeeper-overlay{
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}

@media (prefers-reduced-motion: reduce){
  .modal,
  .gift-sheet,
  .result-sheet,
  .pay-sheet,
  .tonkeeper-sheet{
    transition: none !important;
  }
  .modal-overlay,
  .gift-sheet-overlay,
  .tonkeeper-overlay{
    transition: none !important;
  }
}

/* =====================================================================
   Patch v25 (2026-01-05)
   - Quick top-up: bigger bag, no square around close
   - Colors: same background as other menus (var(--tg-bg-elevated))
   - Shortage: no separate "card" box, center text
   - Balance pill: remove huge outer plaque
   - Smoothen transitions a bit more
   ===================================================================== */

:root{
  --ui-menu-ms: 420ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Advanced search: match other inputs + remove corner color artifacts */
.advanced-search{
  background: var(--tg-bg-elevated) !important;
  border: 1px solid var(--tg-border-subtle) !important;
  border-radius: 18px !important;
  overflow: hidden !important;
}

/* Bottom-sheet overlay spacing: keep it flush to the bottom */
.tonkeeper-overlay{
  padding: 0 12px 0 !important;
}

.tonkeeper-sheet{
  background: var(--tg-bg-elevated) !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 24px 24px 0 0 !important;
  padding: 14px 16px calc(18px + 0px) !important;
}

/* Close button: same behavior as other menus (no permanent square) */
.tonkeeper-close{
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  width: 44px !important;
  height: 44px !important;
  border: none !important;
  background: transparent !important;
  border-radius: 12px !important;
  color: rgba(255,255,255,0.92) !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.tonkeeper-close::before,
.tonkeeper-close::after{
  content: none !important;
  display: none !important;
}
.tonkeeper-close:hover{ background: rgba(255,255,255,0.08) !important; }
.tonkeeper-close:active{ background: rgba(255,255,255,0.12) !important; }

/* Bag animation bigger */
.tonkeeper-purse{
  width: 204px !important;
  height: 156px !important;
  margin: 2px auto 6px !important;
}

/* Shortage: centered, no separate rounded rectangle */
.tonkeeper-sheet .balance-shortage{
  background: transparent !important;
  border: none !important;
  padding: 6px 0 2px !important;
  margin: 4px 0 10px !important;
  text-align: center !important;
}
.tonkeeper-sheet .balance-shortage-title{
  align-items: center !important;
  text-align: center !important;
}
.tonkeeper-sheet .balance-shortage-head{
  color: var(--tg-red) !important;
}

/* Balance widget: remove big outer plaque; keep two compact pills */
.balance-widget{
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  gap: 8px !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.balance-pill.balance-pill--single{
  height: 32px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}
.balance-pill-icon{
  width: 22px !important;
  height: 22px !important;
}
.balance-plus-btn{
  width: 32px !important;
  height: 32px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}



/* =====================================================================
   Patch v26 (2026-01-05)
   - Advanced number-search: background matches app, keep grey edges
   - Tonkeeper/Topup menus: full perimeter radius + no blur + crisp text
   - Fonts: avoid faux-bold / blurry weights
   ===================================================================== */

:root{
  --font-sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;
}

body{
  text-rendering: auto !important;
}

/* Search by #number */
.advanced-search{
  background: var(--tg-bg) !important;
}

/* Tonkeeper overlays should cover the real visible viewport (Telegram WebView) */
.tonkeeper-overlay{
  height: var(--tg-viewport-height, 100vh) !important;
  min-height: var(--tg-viewport-height, 100vh) !important;
  width: 100% !important;
  padding: 0 12px calc(12px + 0px) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Show rounding on the whole perimeter (needs bottom padding above) */
.tonkeeper-sheet{
  border-radius: 24px !important;
  transform: translateY(110%) !important;
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform;
}
.tonkeeper-overlay.visible .tonkeeper-sheet{
  transform: translateY(0) !important;
}
.tonkeeper-overlay.settled .tonkeeper-sheet{
  transform: none !important;
  will-change: auto !important;
}

/* Softer weights (avoid faux-bold / blurry glyphs in WebViews) */
.tonkeeper-title,
.modal-title{
  font-weight: 700 !important;
}

.tonkeeper-btn{
  font-weight: 700 !important;
}


/* =====================================================================
   Patch v27 (2026-01-05)
   - Advanced search (#number): inner fill must match app background
   - Tonkeeper / Top-up sheets: MUST slide from bottom, smooth close, no ghost backdrop
   - Purse animation: ensure canvas/svg fills container
   ===================================================================== */

/* 1) Advanced search: wrapper stays rounded, but inner background == page background */
.advanced-panel{ background: transparent !important; }
.advanced-search{ background: transparent !important; }
.advanced-search .search-input{ background: transparent !important; }

/* 2) Tonkeeper overlays: always bottom-sheet + smooth open/close */
.tonkeeper-overlay{
  /* Always behave like a bottom sheet, regardless of older patches */
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;

  /* Backdrop (no blur: TG WebView leaves trails) */
  background: rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;

  /* Prevent “ghost” backdrop: use visibility + opacity */
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity var(--ui-menu-ms) var(--ease-out), visibility 0ms linear var(--ui-menu-ms) !important;
}
.tonkeeper-overlay.visible,
.tonkeeper-overlay.closing{
  visibility: visible !important;
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}
.tonkeeper-overlay.visible{
  opacity: 1 !important;
  pointer-events: auto !important;
}
.tonkeeper-overlay.closing{
  opacity: 0 !important;
  pointer-events: auto !important;
}

.tonkeeper-sheet{
  width: min(520px, 100%) !important;
  max-width: 520px !important;
  margin: 0 auto !important;
  border-radius: 24px !important; /* full perimeter */
  background: var(--tg-bg-elevated) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45) !important;
  overflow: visible !important;

  transform: translate3d(0, 110%, 0) !important;
  opacity: 1 !important;
  transition: transform var(--ui-menu-ms) var(--ease-out), opacity var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform;
}
.tonkeeper-overlay.visible .tonkeeper-sheet{ transform: translate3d(0, 0, 0) !important; }
.tonkeeper-overlay.closing .tonkeeper-sheet{ transform: translate3d(0, 110%, 0) !important; }

/* Once opened, drop transforms for crisp text in TG WebView */
.tonkeeper-overlay.settled .tonkeeper-sheet{ transform: none !important; will-change: auto !important; }

/* Purse animation: guarantee the renderer fills the rounded area */
.tonkeeper-purse{ display: block !important; }
.tonkeeper-purse canvas,
.tonkeeper-purse svg{
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Fallback purse (SVG) when lottie-web can't load in some TG WebViews */
.purse-fallback{
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 60%;
  animation: purseFloat 1800ms var(--ease-out) infinite;
}
@keyframes purseFloat{
  0%{ transform: translate3d(0, 0, 0) rotate(0deg); }
  50%{ transform: translate3d(0, -4px, 0) rotate(-1.2deg); }
  100%{ transform: translate3d(0, 0, 0) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce){
  .purse-fallback{ animation: none !important; }
}

/* v27 motion: a touch slower, feels less "snappy" in Telegram WebViews */
:root{
  --ui-menu-ms: 360ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}


/* =====================================================================
   Patch v28 (2026-01-05)
   По просьбе Dolphin:
   - Top-up / Confirm menus: как остальные меню (до краёв и до низа, без боковых отступов)
   - Убрать "синюю полоску" у кнопки "Продано" (iOS focus/active артефакт)
   - Анимки/превью: убрать серые квадраты (масштаб + cover)
   ===================================================================== */

/* 1) Tonkeeper / top-up overlays: full-width bottom sheet */
.tonkeeper-overlay{
  padding: 0 !important; /* no side margins */
}

.tonkeeper-sheet{
  width: min(520px, 100%) !important;
  max-width: 520px !important;
  margin: 0 auto !important;
  border-radius: 24px 24px 0 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* 2) Remove iOS blue focus/active artifacts on bottom bars/buttons */
.gift-sheet-buy-bar,
.gift-buy-btn,
.pay-action,
.modal-btn,
.tonkeeper-btn{
  -webkit-appearance: none !important;
  appearance: none !important;
  outline: none !important;
  background-image: none !important;
  -webkit-tap-highlight-color: transparent !important;
}
.gift-sheet-buy-bar:focus,
.gift-buy-btn:focus,
.pay-action:focus,
.modal-btn:focus,
.tonkeeper-btn:focus{
  outline: none !important;
}
.gift-sheet-buy-bar::-moz-focus-inner,
.gift-buy-btn::-moz-focus-inner,
.pay-action::-moz-focus-inner,
.modal-btn::-moz-focus-inner,
.tonkeeper-btn::-moz-focus-inner{
  border: 0 !important;
}

/* 3) Gift previews: avoid grey squares from transparent margins */
.gift-image-wrap,
.gift-sheet-preview-figure,
.gift-sheet-preview-media{
  background: transparent !important;
}
.gift-image,
.gift-sheet-preview-img{
  object-fit: contain !important;
  transform: none !important;
  transform-origin: 50% 50% !important;
}





/* ---------------------
   Patch v29 (Jan 2026)
   - Disable press/tap animations
   - Smooth bottom sheets with keyboard inset
--------------------- */

/* Disable "press" animations everywhere (no scale/tilt/shadow changes on :active). */
button:active,
a:active,
[role="button"]:active,
.chip:active,
.gift-card:active,
.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active,
.pay-action:active,
.tonkeeper-btn:active,
.gift-sheet-buy-bar:active,
.gift-sheet-buy-btn:active {
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

/* Remove tap highlight (WebView) */
* { -webkit-tap-highlight-color: transparent; }

/* Use stable viewport for overlays so keyboard doesn't shrink the container; lift by keyboard inset. */
.tonkeeper-overlay {
  height: var(--tg-viewport-stable-height, 100vh);
  min-height: var(--tg-viewport-stable-height, 100vh);
  align-items: flex-end;
  justify-content: center;
  padding: 16px 0 calc(0px + var(--tg-keyboard-inset, 0px) + 14px);
  box-sizing: border-box;
  transition: opacity 180ms ease, padding-bottom 180ms ease;
}

/* Keep card from sticking too low on iPhone and allow comfortable keyboard space. */
.tonkeeper-sheet {
  margin: 0 22px;
}

/* Gift sheet: no hidden "cover" scaling; keep geometry stable with Lottie container. */
.gift-sheet-lottie-anim { pointer-events: none; }

/* Hide the tap hint by default (we disabled gift animation in the sheet). */
.gift-sheet-tap-hint { display: none !important; }


/* =====================================================================
   Patch v31 (2026-01-06)
   Dolphin fixes:
   - Gift: photo until lottie is ready, then autoplay once and stay on last frame; replay on tap
   - Remove hover/click micro-animations
   ===================================================================== */

/* 1) Gift sheet: hint should be visible (tap-to-replay). */
.gift-sheet-tap-hint {
  display: block !important;
  opacity: 0.9;
}

/* 2) Disable hover/press animations (keep UI stable, no "jump" on tap). */
button,
a,
[role="button"],
.gift-card,
.chip,
.balance-pill,
.balance-plus-btn,
.gift-sheet-buy-bar,
.tonkeeper-btn,
.pay-action {
  transition: none !important;
}

@media (hover:hover) {
  .gift-card:hover,
  .balance-pill:hover,
  .balance-plus-btn:hover,
  .tonkeeper-btn:hover,
  .pay-action:hover,
  .gift-sheet-buy-bar:hover,
  .chip:hover {
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
  }
}

.balance-pill:active,
.balance-plus-btn:active {
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

/* 3) Bottom sheets: full-width on Telegram WebApp (no side gaps). */
html.tg-webapp .tonkeeper-overlay {
  padding-left: 0 !important;
  padding-right: 0 !important;
  transition: opacity 180ms ease, padding-bottom 240ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

html.tg-webapp .tonkeeper-sheet {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  border-radius: 24px 24px 0 0 !important;
  padding-bottom: calc(16px + 0px) !important;
}

html.tg-webapp .pay-sheet {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  border-radius: 24px 24px 0 0 !important;
  padding-bottom: calc(16px + 0px) !important;
}

/* 4) Confirm / waiting-payment text: make it readable. */
.tonkeeper-title {
  font-size: 18px !important;
  line-height: 22px !important;
}

.tonkeeper-subtitle,
.tonkeeper-hint,
.tonkeeper-state-sub {
  font-size: 14px !important;
  line-height: 18px !important;
}

/* 5) Balance pill: keep it compact like Telegram (icon + number + plus). */

/* Force a Telegram-wallet-like pill (matches reference screenshot). */
.balance-widget {
  display: flex;
  align-items: center;
  gap: 8px;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: var(--tg-text);
}

.balance-pill-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tg-accent);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  line-height: 14px;
}

.balance-pill-amount {
  font-weight: 800;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.01em;
}

.balance-plus-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: var(--tg-text);
  font-size: 22px;
  line-height: 22px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


/* =====================================================================
   Patch v32 (2026-01-06)
   Dolphin feedback:
   - Remove hover highlight on close icons + remove remaining click micro-animations
   - Make top-up modal typography crisp (no "pixel" feel) + better spacing
   - Advanced search: slightly stronger outlines
   - Balance pill (+) redesign while keeping the same size
   ===================================================================== */

/* 1) Close icons: absolutely no hover/active highlight or rotation/scale. */
.modal-close-btn,
.gift-sheet-close,
.result-sheet-close,
.tonkeeper-close,
.search-clear {
  transition: none !important;
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

.modal-close-btn:hover,
.gift-sheet-close:hover,
.result-sheet-close:hover,
.tonkeeper-close:hover,
.search-clear:hover,
.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active,
.tonkeeper-close:active,
.search-clear:active {
  background: transparent !important;
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

.tonkeeper-close {
  color: rgba(255,255,255,0.78) !important;
}

/* 2) Remove remaining tap/press transforms from actions (no “click animation”). */
button:active,
a:active,
[role="button"]:active,
.pay-action:active,
.tonkeeper-btn:active,
.gift-buy-btn:active,
.gift-sheet-buy-bar:active,
.chip:active {
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

/* 3) Crisp typography inside the top-up menu (fix “pixelated” feeling). */
.tonkeeper-sheet,
.tonkeeper-sheet * {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
}

.tonkeeper-title {
  font-size: 20px !important;
  line-height: 24px !important;
  letter-spacing: 0.01em;
}

/* Shortage block: nicer hierarchy and spacing */
#quick-topup-shortage {
  margin-top: 10px !important;
  margin-bottom: 12px !important;
}

.tonkeeper-sheet .balance-shortage-title {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 6px !important;
}

.tonkeeper-sheet .balance-shortage-head {
  font-size: 13px !important;
  line-height: 16px !important;
  font-weight: 750 !important;
  color: var(--tg-red) !important;
}

.tonkeeper-sheet .balance-shortage-need {
  font-size: 15px !important;
  line-height: 18px !important;
  font-weight: 800 !important;
  color: rgba(255,255,255,0.92) !important;
  font-variant-numeric: tabular-nums;
}

/* 4) Advanced search: a bit more expressive outline. */
.advanced-search {
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  background: rgba(255, 255, 255, 0.045) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.30) !important;
}

/* 5) Balance pill redesign (same size), slightly more contrast. */
.balance-pill {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35) !important;
}

.balance-plus-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35) !important;
}

/* No hover highlight for the balance pill / plus (keep identical look on hover). */
@media (hover:hover) {
  .balance-pill:hover,
  .balance-plus-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35) !important;
    filter: none !important;
  }
}


/* =====================================================================
   Patch v33 (2026-01-06)
   Dolphin feedback:
   - Advanced number input: slightly less expressive outline
   - Quick top-up sheet: nicer ("normal") typography + real shortage styling
   - Close icons: ensure absolutely no hover/focus highlight (higher specificity)
   ===================================================================== */

/* 1) Advanced search (#number): tone down borders/shadows a bit. */
.advanced-search {
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  background: rgba(255, 255, 255, 0.035) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 8px 18px rgba(0, 0, 0, 0.24) !important;
}

/* 2) Top-up sheet: remove "pixel" feel by avoiding aggressive text rendering hints. */
.tonkeeper-sheet,
.tonkeeper-sheet * {
  text-rendering: auto !important;
}

/* Make the top-up menu layout feel like a single cohesive card. */
#topup-menu-sheet {
  text-align: center;
}

.tonkeeper-title {
  font-size: 19px !important;
  line-height: 24px !important;
  letter-spacing: 0 !important;
  margin: 10px 0 10px !important;
}

/* 3) "Недостаточно средств": make it visibly different and readable. */
#quick-topup-shortage {
  width: 100% !important;
  margin: 10px 0 14px !important;
  padding: 10px 12px !important;
  border-radius: 16px !important;
  background: rgba(242, 63, 66, 0.10) !important;
  border: 1px solid rgba(242, 63, 66, 0.22) !important;
}

.tonkeeper-sheet .balance-shortage-title {
  gap: 4px !important;
}

.tonkeeper-sheet .balance-shortage-head {
  font-size: 14px !important;
  line-height: 18px !important;
  font-weight: 700 !important;
  color: rgba(242, 63, 66, 0.98) !important;
}

.tonkeeper-sheet .balance-shortage-need {
  font-size: 16px !important;
  line-height: 20px !important;
  font-weight: 800 !important;
  color: rgba(255, 255, 255, 0.94) !important;
  font-variant-numeric: tabular-nums;
}

#quick-topup-shortage-amount {
  font-weight: 900 !important;
}

/* 4) Close icons: absolutely no hover/focus background. Some earlier rules use higher specificity. */
.gift-sheet-overlay .gift-sheet-close,
.gift-sheet .gift-sheet-close,
.pay-sheet .gift-sheet-close,
.modal-overlay .modal-close-btn,
.result-sheet .result-sheet-close,
.tonkeeper-sheet .tonkeeper-close,
.tonkeeper-overlay .tonkeeper-close,
.advanced-search .search-clear {
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  outline: none !important;
}

.gift-sheet-overlay .gift-sheet-close:hover,
.gift-sheet .gift-sheet-close:hover,
.pay-sheet .gift-sheet-close:hover,
.modal-overlay .modal-close-btn:hover,
.result-sheet .result-sheet-close:hover,
.tonkeeper-sheet .tonkeeper-close:hover,
.tonkeeper-overlay .tonkeeper-close:hover,
.advanced-search .search-clear:hover,
.gift-sheet-overlay .gift-sheet-close:active,
.gift-sheet .gift-sheet-close:active,
.pay-sheet .gift-sheet-close:active,
.modal-overlay .modal-close-btn:active,
.result-sheet .result-sheet-close:active,
.tonkeeper-sheet .tonkeeper-close:active,
.tonkeeper-overlay .tonkeeper-close:active,
.advanced-search .search-clear:active,
.gift-sheet-overlay .gift-sheet-close:focus,
.gift-sheet .gift-sheet-close:focus,
.pay-sheet .gift-sheet-close:focus,
.modal-overlay .modal-close-btn:focus,
.result-sheet .result-sheet-close:focus,
.tonkeeper-sheet .tonkeeper-close:focus,
.tonkeeper-overlay .tonkeeper-close:focus,
.advanced-search .search-clear:focus,
.gift-sheet-overlay .gift-sheet-close:focus-visible,
.gift-sheet .gift-sheet-close:focus-visible,
.pay-sheet .gift-sheet-close:focus-visible,
.modal-overlay .modal-close-btn:focus-visible,
.result-sheet .result-sheet-close:focus-visible,
.tonkeeper-sheet .tonkeeper-close:focus-visible,
.tonkeeper-overlay .tonkeeper-close:focus-visible,
.advanced-search .search-clear:focus-visible {
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  outline: none !important;
}

/* Confirm overlay spinner ("Завершите оплату"). */
.tonkeeper-sheet--confirm .confirm-spinner{ display: block !important; }

/* Balance pill/+ : keep exactly the same look on hover/active/focus (no click animation). */
.balance-pill:active,
.balance-pill:focus,
.balance-pill:focus-visible,
.balance-plus-btn:active,
.balance-plus-btn:focus,
.balance-plus-btn:focus-visible{
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35) !important;
  outline: none !important;
}


/* =====================================================================
   Patch v34 (2026-01-06)
   Dolphin feedback:
   - Вернуть крутящуюся штуку на "Завершите оплату"
   - Убрать анимации кликов/наведений (оставить только плавные выдвижные меню)
   - Верхнее меню баланса сделать как на референсе (капсула + плюс), валюта ₽
   ===================================================================== */

/* 1) Spinner is enabled (older patches hid it globally). */
.tonkeeper-sheet--confirm .confirm-spinner{
  display: block !important;
}

/* 2) Disable micro-animations on hover/press for interactive elements.
      (Do NOT touch bottom-sheet / modal transitions.) */
button,
a,
[role="button"],
.gift-card,
.filter-btn,
.chip,
.btn-outline,
.modal-btn,
.pay-action,
.gift-sheet-buy-bar,
.gift-buy-btn,
.scroll-top-btn,
.search-clear{
  transition: none !important;
}

@media (hover:hover) {
  button:hover,
  a:hover,
  [role="button"]:hover,
  .gift-card:hover,
  .filter-btn:hover,
  .chip:hover,
  .btn-outline:hover,
  .modal-btn:hover,
  .pay-action:hover,
  .gift-sheet-buy-bar:hover,
  .gift-buy-btn:hover,
  .scroll-top-btn:hover,
  .search-clear:hover{
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
  }
}

button:active,
a:active,
[role="button"]:active,
.gift-card:active,
.filter-btn:active,
.chip:active,
.btn-outline:active,
.modal-btn:active,
.pay-action:active,
.gift-sheet-buy-bar:active,
.gift-buy-btn:active,
.scroll-top-btn:active,
.search-clear:active{
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

/* 3) Balance widget: Telegram-wallet-like capsule (reference screenshot). */
.balance-widget{
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 6px 4px 4px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.balance-pill{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  height: 34px !important;
  padding: 4px 10px 4px 4px !important;
  border-radius: 999px !important;
  color: #101010 !important;
}

.balance-pill-icon{
  width: 28px !important;
  height: 28px !important;
  background: #2f80ff !important;
  color: #ffffff !important;
  font-weight: 900 !important;
}

.balance-pill-amount{
  color: #101010 !important;
  font-weight: 900 !important;
  font-variant-numeric: tabular-nums;
}

.balance-plus-btn{
  width: 34px !important;
  height: 34px !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  border: 1px solid rgba(0,0,0,0.10) !important;
  box-shadow: none !important;
  color: #101010 !important;
}

@media (hover:hover){
  .balance-pill:hover,
  .balance-plus-btn:hover{
    background: transparent !important;
    border-color: inherit !important;
    box-shadow: none !important;
    filter: none !important;
  }
}


/* =====================================================================
   Patch v35 (2026-01-06)
   Dolphin feedback:
   - Balance pill: 1:1 like TON reference, but RUB (dark blue pill + white plus)
   - Disable click/hover micro-animations (including promo photo press)
   - Slide-out menus: smoother + no blur/ghost shadows
   - Advanced search: slightly thinner side paddings
   - Reset button: perfectly centered label
   ===================================================================== */

:root{
  /* Keep JS timers in sync (app.js reads this once). */
  --ui-menu-ms: 260ms;
  --ease-out: cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* 1) Balance pill (TON-like) */
.balance-widget{
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 4px 6px 4px 6px !important;
  border-radius: 999px !important;
  background: #0d3558 !important;
  border: 0 !important;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.balance-pill{
  height: 28px !important;
  padding: 2px 10px 2px 2px !important;
  border-radius: 999px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.balance-pill-icon{
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px !important;
  background: #1689ff !important;
  color: #ffffff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

.balance-pill-amount{
  color: rgba(255,255,255,0.92) !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  line-height: 1 !important;
  font-variant-numeric: tabular-nums;
}

.balance-plus-btn{
  width: 28px !important;
  height: 28px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.96) !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #0d3558 !important;
  font-weight: 700 !important;
  font-size: 18px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

@media (hover:hover){
  .balance-pill:hover,
  .balance-plus-btn:hover{ filter:none !important; box-shadow:none !important; }
}

/* 2) Disable ALL hover/click micro-animations (keep only slide animations). */
.top-promo-banner--photo,
.top-promo-banner--photo * ,
.gift-card,
.gift-card * ,
.filter-btn,
.chip,
.btn-outline,
.modal-btn,
.pay-action,
.gift-sheet-buy-bar,
.gift-buy-btn,
.inline-reset-btn,
.search-clear,
.scroll-top-btn,
.balance-pill,
.balance-plus-btn{
  transition: none !important;
}

.top-promo-banner--photo:active,
.gift-card:active,
.gift-card:active .gift-image,
.gift-card:active img,
.gift-card:active .gift-card-media,
.filter-btn:active,
.chip:active,
.btn-outline:active,
.modal-btn:active,
.pay-action:active,
.gift-sheet-buy-bar:active,
.gift-buy-btn:active,
.inline-reset-btn:active,
.scroll-top-btn:active,
.search-clear:active{
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

/* 3) Slide-out menus: planar & GPU-friendly (no blur trails / ghost shadows). */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay{
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.modal,
.gift-sheet,
.result-sheet,
.pay-sheet,
.tonkeeper-sheet{
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

.modal-overlay{
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity var(--ui-menu-ms) var(--ease-out), visibility 0ms linear var(--ui-menu-ms) !important;
}
.modal-overlay.open,
.modal-overlay.closing{
  visibility: visible !important;
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}
.modal-overlay.open{
  opacity: 1 !important;
  pointer-events: auto !important;
}
.modal-overlay.closing{
  opacity: 0 !important;
  pointer-events: none !important;
}

.modal-overlay .modal{
  transform: translate3d(0, 12px, 0) !important;
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
}
.modal-overlay.open .modal{
  transform: translate3d(0, 0, 0) !important;
}
.modal-overlay.closing .modal{
  transform: translate3d(0, 12px, 0) !important;
}

.gift-sheet-overlay{
  background: rgba(0, 0, 0, 0.55) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity var(--ui-menu-ms) var(--ease-out), visibility 0ms linear var(--ui-menu-ms) !important;
}
.gift-sheet-overlay[aria-hidden="false"]{
  visibility: visible !important;
}
.gift-sheet-overlay.visible{
  opacity: 1 !important;
  pointer-events: auto !important;
  transition: opacity var(--ui-menu-ms) var(--ease-out) !important;
}

.gift-sheet{
  box-shadow: none !important;
  transform: translate3d(0, 110%, 0) !important;
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
}
.gift-sheet.open{
  transform: translate3d(0, 0, 0) !important;
}

/* 4) Advanced search: slightly thinner side paddings */
.advanced-search .search-input{
  padding-left: 32px !important;
  padding-right: 32px !important;
}

/* 5) Reset button: perfectly centered text */
.inline-reset-btn{
  padding: 0 18px !important;
  line-height: 1 !important;
}




/* --- v36 polish: smooth keyboard shift for bottom sheets --- */
.tonkeeper-overlay{
  padding-bottom: calc(12px + 0px + var(--tg-keyboard-inset, 0px)) !important;
  transition: opacity var(--ui-menu-ms) var(--ease-out), padding-bottom 220ms var(--ease-out), visibility 0ms linear var(--ui-menu-ms) !important;
}
.tonkeeper-overlay.visible{
  transition: opacity var(--ui-menu-ms) var(--ease-out), padding-bottom 220ms var(--ease-out) !important;
}
.tonkeeper-overlay.closing{
  transition: opacity var(--ui-menu-ms) var(--ease-out), padding-bottom 220ms var(--ease-out), visibility 0ms linear var(--ui-menu-ms) !important;
}

/* Compact "insufficient funds" block (less vertical height, centered text) */
#quick-topup-shortage{
  padding: 8px 12px !important;
}
#quick-topup-shortage .balance-shortage-title{
  align-items: center !important;
  text-align: center !important;
}


/* =====================================================================
   Patch v37 (2026-01-06)
   Dolphin feedback:
   - Balance widget: match TON ref 1:1 (RUB), less bold, smaller + button
   - Reduce empty space between top of app and banner
   - Tonkeeper (topup / confirm) sheets: animate from their position (not from screen bottom)
   - Fonts: make rendering crisp (avoid "pixel" look)
   - Advanced search input: thinner/cleaner grey edges
   ===================================================================== */

:root {
  /* Motion: smooth but not laggy */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ui-menu-ms: 280ms;
  --transition-fast: 180ms var(--ease-out);
  --transition-slow: 280ms var(--ease-out);

  /* Typography: prefer system UI fonts in Telegram WebViews */
  --font-sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;
}

html,
body {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: geometricPrecision !important;
}

body {
  font-weight: 500;
}

/* Top spacing above banner (too much empty space previously) */
.topbar {
  padding: calc(0px + 2px) 0 2px !important;
}

.top-promo-banner--photo {
  margin: 0 0 10px !important;
}

/* Balance widget: same geometry as TON reference (but ₽) */
.balance-widget {
  padding: 4px 6px !important;
  gap: 10px !important;
  border-radius: 999px !important;
  background: rgba(10, 27, 44, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32) !important;
}

.balance-pill {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  gap: 8px !important;
}

.balance-pill-icon {
  width: 22px !important;
  height: 22px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  background: rgba(46, 133, 255, 0.95) !important;
}

.balance-pill-amount {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.92) !important;
}

.balance-plus-btn {
  width: 26px !important;
  height: 26px !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  color: #111 !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: none !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  padding: 0 !important;
}

/* Keep hover/active clean (no highlights) */
@media (hover:hover) {
  .balance-pill:hover,
  .balance-plus-btn:hover {
    filter: none !important;
    box-shadow: none !important;
  }
}

/* Tonkeeper overlays: should not slide from screen bottom */
.tonkeeper-overlay {
  background: rgba(0, 0, 0, 0.55) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 18px 14px calc(18px + 0px + var(--tg-keyboard-inset, 0px)) !important;
}

.tonkeeper-sheet {
  width: min(92vw, 380px) !important;
  border-radius: 22px !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55) !important;
  opacity: 0 !important;
  transform: translate3d(0, 12px, 0) scale(0.98) !important;
  transition: transform var(--ui-menu-ms) var(--ease-out), opacity var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform, opacity;
}

.tonkeeper-overlay.visible .tonkeeper-sheet {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) scale(1) !important;
}

.tonkeeper-overlay.closing .tonkeeper-sheet {
  opacity: 0 !important;
  transform: translate3d(0, 12px, 0) scale(0.98) !important;
}

/* Advanced search (#number): thinner grey edges */
.advanced-search {
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  background: rgba(255, 255, 255, 0.028) !important;
  box-shadow: none !important;
}


/* =====================================================================
   Patch v38 (2026-01-06)
   Dolphin feedback:
   - Balance capsule: clean (no shadow), 1:1 with TON reference (RUB)
   - More air between top of app / balance and the promo banner
   - Tonkeeper cards: show rounded bottom corners (not stuck to screen edge)
   - Remove iOS blue strip artifact on "Продано" button
   - Typography: smooth, non-pixel rendering + sane weights/sizes
   ===================================================================== */

/* Typography: revert overly aggressive rendering hints. */
html,
body {
  font-family: var(--font-sans);
  text-rendering: optimizeLegibility !important;
}

/* Top spacing: make the header not stick to the very top, but keep it compact. */
.topbar {
  padding: calc(0px + 10px) 12px 10px !important;
}
.top-promo-banner--photo {
  margin: 0 0 12px !important;
}

/* Balance capsule: match ref (dark capsule + blue icon + white plus) */
.balance-widget {
  background: #11253a !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 999px !important;
  padding: 6px 8px !important;
  gap: 10px !important;
}

.balance-pill {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 2px !important;
  gap: 8px !important;
  align-items: center !important;
}

.balance-pill-icon {
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px !important;
  background: #35aff1 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.balance-pill-amount {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

.balance-plus-btn {
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  color: #111111 !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

/* Tonkeeper overlays: keep a visible bottom gap so radius is noticeable. */
.tonkeeper-overlay {
  overflow-y: auto !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 22px 14px calc(22px + 0px + var(--tg-keyboard-inset, 0px)) !important;
}

.tonkeeper-sheet {
  width: min(92vw, 380px) !important;
  max-height: calc(100% - 88px) !important;
  background: #2b2b2b !important;
  border-radius: 22px !important;
  overflow: hidden !important;
  clip-path: inset(0 round 22px) !important; /* iOS: robust rounded clipping while transformed */
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55) !important;
}

/* Tone down typography inside top-up/confirm cards */
.tonkeeper-title {
  font-size: 19px !important;
  font-weight: 700 !important;
  margin: 10px 0 10px !important;
}

.tonkeeper-subtitle {
  font-size: 13px !important;
  line-height: 1.35 !important;
  opacity: 0.78 !important;
}

.tonkeeper-input {
  height: 46px !important;
  font-size: 16px !important;
}

.tonkeeper-btn {
  width: 100% !important;
  max-width: none !important;
  height: 48px !important;
  border-radius: 14px !important;
  font-weight: 600 !important;
}

/* Insufficient funds block: compact, centered */
#quick-topup-shortage,
#balance-shortage {
  padding: 8px 12px !important;
  border-radius: 14px !important;
}

#quick-topup-shortage .balance-shortage-title,
#balance-shortage .balance-shortage-title {
  align-items: center !important;
  text-align: center !important;
}

/* Gift sheet: kill iOS blue strip / focus artifact on the bottom bar */
.gift-sheet-buy-bar,
.gift-sheet-buy-bar:focus,
.gift-sheet-buy-bar:focus-visible,
.gift-sheet-buy-bar:active,
.gift-sheet-buy-bar:disabled,
.gift-sheet-buy-bar[data-state="sold"],
.gift-sheet-buy-bar[data-state="sold"]:focus,
.gift-sheet-buy-bar[data-state="sold"]:active {
  outline: none !important;
  box-shadow: none !important;
  background-image: none !important;
  border: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  -webkit-tap-highlight-color: transparent !important;
  background-clip: padding-box !important;
}


/* =====================================================================
   Patch v39 (2026-01-06)
   Dolphin feedback:
   - Header: add subtle dark/blur backdrop so the top menu is clearly separated
   - Balance capsule: match TON ref geometry closer (32px capsule, 20px icon, 24px plus)
   ===================================================================== */

/* Header backdrop (dark + a bit of blur) */
.topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 140 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  padding: calc(0px + 8px) 12px 8px !important;
  background: rgba(0, 0, 0, 0.48) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* Balance capsule should live inside the header (no fixed overlay). */
.balance-widget {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  z-index: auto !important;

  height: 32px !important;
  padding: 3px 6px !important;
  gap: 10px !important;
  border-radius: 999px !important;
  background: rgba(10, 27, 44, 0.96) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

.balance-pill {
  height: 26px !important;
  padding: 0 2px !important;
  display: inline-flex !important;
  align-items: center !important;
}

.balance-pill-icon {
  width: 22px !important;
  height: 22px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  background: rgba(46, 133, 255, 0.96) !important;
}

.balance-plus-btn {
  width: 26px !important;
  height: 26px !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
}


/* =====================================================================
   Patch v40 (2026-01-06)
   Dolphin feedback:
   - Topbar background: revert the "blur bar" (it looked wrong in TG WebView)
     and make it clean/solid like the reference.
   - Balance widget: remove white edges/double shapes, fix the "+" alignment,
     make the "+" circle smaller (1:1 geometry with TON ref but RUB).
   ===================================================================== */

/* Topbar: clean solid background (no blur, no border) */
.topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 140 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  padding: calc(0px + 8px) 12px 10px !important;
  background: #141414 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 0 !important;
}

/* Add a tiny gap between header and banner (not stuck together) */
.top-promo-banner {
  margin-top: 6px !important;
}

/* Balance capsule (single outer shape) */
.balance-widget {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  height: 30px !important;
  padding: 3px 5px !important;
  gap: 8px !important;
  border-radius: 999px !important;
  background: rgba(10, 33, 54, 0.98) !important;
  border: 0 !important;          /* remove white edges */
  box-shadow: none !important;   /* remove ugly shadow */
}

/* Inner pill: transparent (so no "double capsule") */
.balance-pill.balance-pill--single {
  height: 24px !important;
  padding: 0 2px 0 2px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.balance-pill-icon {
  width: 20px !important;
  height: 20px !important;
  border-radius: 999px !important;
  background: rgba(46, 133, 255, 0.98) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.balance-pill-amount {
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0.1px !important;
  color: #ffffff !important;
  font-variant-numeric: tabular-nums;
}

/* Plus button: smaller circle + perfectly centered plus (no font baseline issues) */
.balance-plus-btn {
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  position: relative !important;
  font-size: 0 !important; /* hide '+' glyph */
  line-height: 0 !important;
  color: transparent !important;
  -webkit-tap-highlight-color: transparent !important;
}

.balance-plus-btn::before,
.balance-plus-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #111;
  border-radius: 2px;
}

.balance-plus-btn::before {
  width: 10px;
  height: 2px;
}

.balance-plus-btn::after {
  width: 2px;
  height: 10px;
}

/* No hover/active animations on the header widget */
.balance-plus-btn:hover,
.balance-plus-btn:active,
.balance-pill:hover,
.balance-pill:active {
  transform: none !important;
  filter: none !important;
}


/* =====================================================================
   Patch v41 (2026-01-06)
   Dolphin: balance menu should not "follow" across UI, must be anchored
   above the banner with minimal top spacing; plus button must not darken;
   balance pill must align with the banner edge.
   ===================================================================== */

/* Header should be part of normal flow (not sticky/fixed) so it doesn't
   overlay other UI (modals/sheets) and doesn't "chase" the user. */
.topbar {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;

  /* Avoid double horizontal padding: <main> already has 12px sides. */
  padding-left: 0 !important;
  padding-right: 0 !important;

  padding-top: calc(0px + 2px) !important;
  padding-bottom: 4px !important;
}

main {
  padding-top: 0 !important;
}

/* Banner should sit close to the topbar. */
.top-promo-banner--photo {
  margin-top: 0 !important;
}

/* Ensure the balance capsule aligns exactly with the banner/content edge. */
.balance-widget {
  margin-right: 0 !important;
}

/* "+" button: keep it white in all states (no darkening). */
.balance-plus-btn:hover,
.balance-plus-btn:active,
.balance-plus-btn:focus,
.balance-plus-btn:focus-visible {
  background: #fff !important;
  opacity: 1 !important;
  filter: none !important;
}


/* =====================================================================
   Patch v42 (2026-01-06)
   Dolphin: match reference project
   - Make the top promo banner smaller/compact
   - Tune top spacing so the app "starts" closer to the top (like screenshot)
   - Remove white outlines/borders on buttons/cards/gifts across the UI
   ===================================================================== */

/* Compact header spacing similar to the reference app */
.topbar {
  padding-top: calc(0px + 8px) !important;
  padding-bottom: 8px !important;
}

/* Smaller banner (our previous rules inflated it to 118–126px) */
.top-promo-banner--photo {
  height: 94px !important;
  margin: 0 0 10px !important;
}

@media (max-width: 430px) {
  .top-promo-banner--photo { height: 98px !important; }
}

@media (max-width: 380px) {
  .top-promo-banner--photo { height: 102px !important; }
}

/* Slightly tighter inner padding so text fits comfortably in the smaller banner */
.top-banner-overlay { padding: 10px 12px 8px !important; }

/* ────────────────────────────────────────────────────────────────────
   Remove white borders / outlines (buttons, gift cards, pills, etc.)
   Keep focus-visible ring rules where explicitly set (blue accent).
   ──────────────────────────────────────────────────────────────────── */

:root {
  /* In case some components use these vars directly */
  --tg-border-subtle: rgba(255, 255, 255, 0.0);
  --tg-border: rgba(255, 255, 255, 0.0);
}

/* Buttons / pills */
button,
.btn,
.buy-btn,
.gift-buy-btn,
.filters-bar button,
.filters-bar .filter-pill,
.balance-widget,
.balance-pill,
.balance-plus,
.balance-plus-btn,
.modal-btn {
  border: none !important;
}

/* Inputs (search / amount / any text fields) */
input,
textarea,
select,
.search-input,
.modal-search .search-input,
.balance-modal-input-wrap .search-input {
  border: none !important;
}

/* Cards / gift items */
.card,
.gift-card,
.gift-sheet,
.topup-state,
.balance-shortage {
  border: none !important;
}


/* =====================================================================
   Patch v44 (2026-01-06)
   Dolphin:
   - Search inputs: inner fill must match app background, loupe must be centered
   - Balance pill: digits + ₽ baseline alignment (no "floating" currency)
   - Close icon: one crisp X everywhere (incl. Tonkeeper / quick topup)
   ===================================================================== */

/* 1) Advanced search (#number): wrapper chrome, inner fill == app bg */
.advanced-search{
  background: var(--tg-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  border-radius: 18px !important;
}
.advanced-search .search-input{
  background: transparent !important;
  padding: 10px 40px 10px 42px !important;
  line-height: 1.2 !important;
}
.advanced-search .search-icon{
  left: 16px !important;
  width: 16px !important;
  height: 16px !important;
  background-size: 16px 16px !important;
  top: 50% !important;
  transform: translateY(calc(-50% + 0.5px)) !important; /* optical centering */
}

/* 2) Filter modals (collections/models/backdrops): search input like reference */
#collections-modal .modal-search .search-input,
#models-modal .modal-search .search-input,
#backdrops-modal .modal-search .search-input{
  background-color: var(--tg-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  height: 46px !important;
  border-radius: 16px !important;
  padding-left: 42px !important;
  background-position: 16px 50% !important;
  background-size: 16px 16px !important;
}

/* 3) Balance pill: render currency via CSS for consistent baseline */
.balance-pill-amount{
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
  font-variant-numeric: tabular-nums;
}
.balance-pill-amount::after{
  content: " ₽";
  margin-left: 3px;
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0.94;
  transform: translateY(0.5px);
}
/* Icon ruble inside blue dot: slight optical nudge */
.balance-pill-icon{
  transform: translateY(-0.3px) !important;
}

/* 4) One crisp X everywhere (no glyph blur, no square background) */
.modal-close-btn,
.gift-sheet-close,
.result-sheet-close,
.tonkeeper-close{
  width: 44px !important;
  height: 44px !important;
  border: none !important;
  background: transparent !important;
  border-radius: 14px !important;
  color: #ffffff !important;
  font-size: 0 !important; /* hide glyph */
  line-height: 1 !important;
  position: absolute !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}

/* Preserve positioning for close buttons that are not absolute in markup */
.modal-close-btn{ position: relative !important; }

.modal-close-btn::before,
.modal-close-btn::after,
.gift-sheet-close::before,
.gift-sheet-close::after,
.result-sheet-close::before,
.result-sheet-close::after,
.tonkeeper-close::before,
.tonkeeper-close::after{
  content: "" !important;
  display: block !important;
  position: absolute !important;
  width: 18px !important;
  height: 2px !important;
  background: currentColor !important;
  border-radius: 2px !important;
  top: 50% !important;
  left: 50% !important;
  transform-origin: center !important;
}

.modal-close-btn::before,
.gift-sheet-close::before,
.result-sheet-close::before,
.tonkeeper-close::before{
  transform: translate(-50%, -50%) rotate(45deg) !important;
}
.modal-close-btn::after,
.gift-sheet-close::after,
.result-sheet-close::after,
.tonkeeper-close::after{
  transform: translate(-50%, -50%) rotate(-45deg) !important;
}

.modal-close-btn:hover,
.gift-sheet-close:hover,
.result-sheet-close:hover,
.tonkeeper-close:hover,
.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active,
.tonkeeper-close:active,
.modal-close-btn:focus,
.gift-sheet-close:focus,
.result-sheet-close:focus,
.tonkeeper-close:focus,
.modal-close-btn:focus-visible,
.gift-sheet-close:focus-visible,
.result-sheet-close:focus-visible,
.tonkeeper-close:focus-visible{
  background: transparent !important;
  outline: none !important;
}


/* =====================================================================
   Balance widget — match reference pill style (RUB)
   ===================================================================== */

/* Outer pill (contains both the amount and the + button) */
.balance-widget{
  background-color: rgba(0, 122, 255, 0.16) !important; /* #007AFF29 */
  border: 0 !important;
  border-radius: 999px !important;
  padding: 6px 8px !important;
  gap: 8px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Left part: icon + amount (click opens balance modal) */
.balance-pill{
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  line-height: 18px !important;
}
.balance-pill:active{ transform: none !important; }

/* Blue round currency dot (replaces TON logo) */
.balance-pill-icon{
  width: 20px !important;
  height: 20px !important;
  border-radius: 999px !important;
  background: #35AFF1 !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  transform: translateY(-0.2px) !important; /* optical centering */
}

/* Amount + currency symbol */
.balance-pill-amount{
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
  font-variant-numeric: tabular-nums;
}
.balance-pill-amount::after{
  content: " ₽";
  margin-left: 4px;
  font-size: inherit;
  font-weight: inherit;
  opacity: 1;
  transform: none;
}

/* Right part: round white + button */
.balance-plus-btn{
  width: 20px !important;
  height: 20px !important;
  padding: 4px !important;
  border-radius: 999px !important;
  border: 0 !important;
  background: #fff !important;
  color: #000 !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 0 !important;
}
.balance-plus-btn svg{ display: block !important; }
.balance-plus-btn:active{ transform: none !important; }
.balance-plus-btn:hover{ filter: none !important; box-shadow: none !important; }


/* =====================================================================
   Patch v21 (2026-01-07)
   Требования из чата:
   - В меню фильтров (коллекции/модели/фон) НЕ должно быть "чёрных" заливок:
     фон = как у меню (#282727), только обводка.
   - Увеличить фото/название/цены в списках.
   - Выровнять название по центру относительно фото (вертикально).
   - Меню/шиты должны прижиматься к низу (без пустого зазора снизу).
   ===================================================================== */

/* 1) Bottom sheets: убираем лишний padding снизу у оверлеев (он поднимает меню и оставляет пустой зазор). */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay{
  padding-bottom: 0 !important;
}

/* 2) Поиск в меню фильтров: без тёмной заливки, только обводка. */
#collections-modal .modal-search .search-input,
#models-modal .modal-search .search-input,
#backdrops-modal .modal-search .search-input{
  background-color: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
}

/* 3) Чекбокс в меню фильтров: только обводка (без заливки), заливка — только в выбранном состоянии. */
#collections-modal .modal-check,
#models-modal .modal-check,
#backdrops-modal .modal-check{
  background: transparent !important;
}

/* 4) Размеры + выравнивание элементов списка (фото/название/цена). */
#collections-modal .modal-item,
#models-modal .modal-item,
#backdrops-modal .modal-item{
  align-items: center !important;
  min-height: 78px !important;
}

#collections-modal .item-icon,
#models-modal .item-icon,
#backdrops-modal .item-icon{
  width: 54px !important;
  height: 54px !important;
  border-radius: 16px !important;
}

#collections-modal .item-info,
#models-modal .item-info,
#backdrops-modal .item-info{
  justify-content: center !important;
  min-height: 54px !important;
}

#collections-modal .item-name,
#models-modal .item-name,
#backdrops-modal .item-name{
  font-size: 19px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}

#collections-modal .item-price,
#models-modal .item-price,
#backdrops-modal .item-price{
  min-width: 120px !important;
}

#collections-modal .price-value-modal,
#models-modal .price-value-modal,
#backdrops-modal .price-value-modal{
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
}

#collections-modal .price-label,
#models-modal .price-label,
#backdrops-modal .price-label{
  font-size: 13px !important;
  line-height: 1.1 !important;
}


/* =====================================================================
   Patch v22 (2026-01-07)
   Dolphin follow-up fixes:
   - Reset button: same blue as balance pill
   - Filters modals: input fill = menu bg (no black), checkbox style like reference
   - Reduce modal min-price font (was too big), remove "white artifacts"
   - Advanced search (#number): bigger loupe + centered text
   - Constrain bottom sheets height (menus must not fly up)
   ===================================================================== */

/* 0) Filters bottom sheets: почти на весь экран, но ограничены *видимой* высотой Telegram WebView
   (иначе на телефонах могут "улетать" вверх при изменении viewport). */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  height: calc(var(--tg-viewport-height, var(--app-height, 100vh)) - 4px) !important;
  max-height: calc(var(--tg-viewport-height, var(--app-height, 100vh)) - 4px) !important;
}

/* 1) Reset button: как в референсе — тёмная плашка + синий акцент (не заливка) */
.inline-reset-btn{
  background: var(--tg-bg-elevated-soft) !important;
  color: #2f80ff !important;
  border: 1px solid rgba(47, 128, 255, 0.55) !important;
  font-weight: 700 !important;
  height: 32px !important;
  padding: 8px 18px !important;
}
.inline-reset-btn:active{
  background: rgba(47, 128, 255, 0.14) !important;
}

/* 2) Filters modals background + search input fill */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  background: #282727 !important;
}

#collections-modal .modal-search .search-input,
#models-modal .modal-search .search-input,
#backdrops-modal .modal-search .search-input{
  background-color: #282727 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: rgba(255,255,255,0.92) !important;
  background-position: 16px 50% !important;
  background-size: 18px 18px !important;
}

/* 3) Checkbox in filters modals: filled blue when selected (like reference) */
#collections-modal .modal-check,
#models-modal .modal-check,
#backdrops-modal .modal-check{
  width: 24px !important;
  height: 24px !important;
  border-radius: 8px !important;
  background: transparent !important;
  border: 1.6px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: none !important;
}

#collections-modal .modal-item.selected .modal-check,
#models-modal .modal-item.selected .modal-check,
#backdrops-modal .modal-item.selected .modal-check{
  background: #2f80ff !important;
  border-color: #2f80ff !important;
}

#collections-modal .modal-check-icon,
#models-modal .modal-check-icon,
#backdrops-modal .modal-check-icon{
  width: 14px !important;
  height: 10px !important;
}

/* 4) Price in filters modals: slightly smaller */
#collections-modal .price-value-modal,
#models-modal .price-value-modal,
#backdrops-modal .price-value-modal{
  font-size: 18px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  font-variant-numeric: tabular-nums !important;
  font-family: var(--font-sans) !important;
}

#collections-modal .price-label,
#models-modal .price-label,
#backdrops-modal .price-label{
  font-size: 12px !important;
  opacity: 0.78 !important;
}

/* 5) Advanced search (#номер): bigger loupe + better baseline */
.advanced-search .search-input{
  height: 46px !important;
  padding: 12px 44px 12px 48px !important;
  line-height: 1.1 !important;
}
.advanced-search .search-icon{
  width: 18px !important;
  height: 18px !important;
  background-size: 18px 18px !important;
  left: 18px !important;
  transform: translateY(-50%) !important;
}

/* 6) Sticky filter platform: фильтры + поиск + сброс всегда на виду,
   но БЕЗ тени/разных оттенков (должно сливаться с фоном). */
.sticky-filters{
  position: sticky;
  top: 0;
  z-index: 18; /* below pull-to-refresh indicator (z=20) */
  background: var(--tg-bg);
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  box-shadow: none;
  border-bottom: none;
}

/* Prevent inner margins from creating double spacing inside sticky block */
.sticky-filters .filters-bar{ margin-bottom: 6px !important; }
.sticky-filters .advanced-panel{ margin-bottom: 6px !important; }
.sticky-filters .inline-reset-btn{
  margin-top: 2px !important;
  margin-bottom: 8px !important;
}

/* =====================================================================
   Patch v25 (2026-01-07)
   Dolphin tweaks:
   - Remove separator line under sticky platform
   - Inline reset button: 1:1 like reference "Очистить фильтр"
   - Modal list typography: slightly smaller names, slightly bigger min price
   - Modal subtitle: bigger + no bottom clipping
   ===================================================================== */

/* 1) Tighten sticky spacing a bit more (matches reference) */
.sticky-filters .filters-bar{ margin-bottom: 4px !important; }
.sticky-filters .advanced-panel{ margin-bottom: 4px !important; }
.sticky-filters .inline-reset-btn{ margin-top: 0 !important; margin-bottom: 6px !important; }

/* 2) Inline reset button look (same size/length/color as reference pill) */
.inline-reset-btn{
  height: 30px !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(47, 128, 255, 0.46) !important;
  color: #2f80ff !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: -0.01em !important;
}
.inline-reset-btn:active{
  background: rgba(47, 128, 255, 0.18) !important;
}

/* 3) Filter modals header subtitle: bigger + avoid descender clipping */
#collections-modal .modal-header,
#models-modal .modal-header,
#backdrops-modal .modal-header{
  padding: 16px 18px 12px !important;
}

#collections-modal .modal-subtitle,
#models-modal .modal-subtitle,
#backdrops-modal .modal-subtitle{
  font-size: 14px !important;
  line-height: 1.45 !important;
  padding-bottom: 2px !important;
}

/* 4) Filter modals list typography */
#collections-modal .item-name,
#models-modal .item-name,
#backdrops-modal .item-name{
  font-size: 17px !important;
  line-height: 1.18 !important;
}

/* =====================================================================
   Patch v26 (2026-01-07)
   Dolphin tweaks:
   - Add a bit more air under sticky platform (first two screenshots)
   - Inline reset button: remove blue outline, keep fill like reference
   - Filter trigger text: fix slight bottom clipping + make icon a bit bigger
   - Backdrops modal: make backdrop previews circular
   ===================================================================== */

/* 1) Sticky platform spacing (more breathing room over the grid) */
.sticky-filters{
  padding-bottom: 10px !important;
}
.sticky-filters .filters-bar{ margin-bottom: 8px !important; }
.sticky-filters .advanced-panel{ margin-bottom: 8px !important; }
.sticky-filters .inline-reset-btn{ margin-top: 2px !important; margin-bottom: 0 !important; }

/* 2) Inline reset button (no blue outline; same filled pill as reference) */
.inline-reset-btn{
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  background: var(--tg-bg-elevated) !important;
  color: #2f80ff !important;
}
.inline-reset-btn:focus,
.inline-reset-btn:focus-visible{
  outline: none !important;
  box-shadow: none !important;
}
.inline-reset-btn:active{
  background: var(--tg-bg-elevated-soft) !important;
}

/* 3) Filter triggers (selected state): slightly bigger icon + lift text by 1px to avoid clipping */
.filters-bar .filter-value-icon{
  width: 24px !important;
  height: 24px !important;
  border-radius: 8px !important;
}
.filter-btn--single .filter-value{
  transform: translateY(-1px);
}

/* 4) Backdrops list: make previews round */
#backdrops-modal .item-icon-backdrop{
  border-radius: 999px !important;
}
#backdrops-modal .item-icon-backdrop img,
#backdrops-modal .item-icon-backdrop > div{
  border-radius: 999px !important;
}

#collections-modal .price-label,
#models-modal .price-label,
#backdrops-modal .price-label{
  font-size: 14px !important;
  line-height: 1.15 !important;
  opacity: 0.82 !important;
}

/* =====================================================================
   Patch v27 (2026-01-07)
   Dolphin feedback:
   - iOS Telegram: content/sheets shouldn't slide under top native buttons
   - Motion: smooth (Portals-like easing)
   ===================================================================== */

:root{
  --tg-ios-topbar: 0px;
  --anim-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --anim-ms: 320ms;
}

/* Telegram iOS overlays a native top control row above the WebView (Close/…)
html.tg-webapp-ios{
  /* Telegram iOS top native controls are often taller than 44px (Close/… row).
     Keep a bit more headroom so content/sheets never slide under them. */
  --tg-ios-topbar: 56px;
}

html.tg-webapp-ios .app-shell{
  padding-top: calc(0px + var(--tg-ios-topbar)) !important;
}

/* Modals are fixed-position and do not inherit .app-shell padding, so add it here too. */
html.tg-webapp-ios .modal-overlay,
html.tg-webapp-ios .tonkeeper-overlay,
html.tg-webapp-ios .gift-sheet-overlay{
  padding-top: calc(0px + var(--tg-ios-topbar)) !important;
}

html.tg-webapp-ios .topbar{
  padding-top: 2px !important;
}

/* Payment / confirm cards: centered, not stretched to edges */
.tonkeeper-overlay{
  padding-left: 14px !important;
  padding-right: 14px !important;
}

.tonkeeper-sheet,
.tonkeeper-sheet--confirm{
  width: min(420px, calc(100% - 28px)) !important;
  max-width: 420px !important;
  border-radius: 24px !important;
  margin: 0 auto calc(12px + 0px) !important;
}

/* Also apply to price-change / success / fail sheets (they are payment-related) */
.gift-sheet-overlay .pay-sheet,
.gift-sheet-overlay .result-sheet{
  width: min(420px, calc(100% - 24px)) !important;
  max-width: 420px !important;
  border-radius: 24px !important;
  margin: 0 auto calc(12px + 0px) !important;
}

/* Motion: unify sheet open/close easing (keep it smooth like portals.tg) */
.modal-overlay,
.gift-sheet-overlay,
.tonkeeper-overlay{
  transition: opacity var(--anim-ms) var(--anim-ease), visibility 0ms linear var(--anim-ms) !important;
}

.modal,
.gift-sheet,
.tonkeeper-sheet,
.pay-sheet,
.result-sheet{
  transition: transform var(--anim-ms) var(--anim-ease), opacity var(--anim-ms) var(--anim-ease) !important;
}

/* =====================================================================
   Patch v28 (2026-01-07)
   Dolphin feedback:
   - Filter triggers: icon + text must be vertically centered (no "text floating")
   - Global gutters: overlays/modals respect the same app padding as main
   - Filter modals: equal breathing room top/bottom inside the WebApp viewport
   ===================================================================== */

:root{
  --app-gutter-x: 12px;
  --overlay-gap-y: 12px;
}

/* Main scroll area: enforce the same gutters everywhere */
main{
  padding-left: var(--app-gutter-x) !important;
  padding-right: var(--app-gutter-x) !important;
}

/* Filter trigger (single selection): keep value perfectly centered */
.filter-btn--single .filter-value{
  transform: none !important;
  align-items: center !important;
}
.filter-btn--single .filter-value-pill{
  align-items: center !important;
}
.filter-btn--single .filter-value-text{
  display: block !important;
  line-height: 1.15 !important;
}

/* Fixed overlays must inherit the same horizontal constraints as the app */
.modal-overlay,
.gift-sheet-overlay,
.tonkeeper-overlay{
  padding-left: var(--app-gutter-x) !important;
  padding-right: var(--app-gutter-x) !important;
}

/* Bottom sheets become inset once we add horizontal gutters – round bottom corners too */
.gift-sheet{
  border-radius: 24px !important;
}

#collections-modal,
#models-modal,
#backdrops-modal{
  padding-top: calc(0px + var(--tg-ios-topbar, 0px) + var(--overlay-gap-y)) !important;
  padding-bottom: calc(0px + var(--overlay-gap-y)) !important;
  align-items: stretch !important;
}

#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  width: 100% !important;
  max-width: 520px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 26px !important;
}

/* =====================================================================
   Patch v29 (2026-01-07)
   Dolphin feedback:
   - Do not truncate collection/model names (no ellipsis) even on the smallest webapp
   - Inline reset pill: perfect vertical centering
   ===================================================================== */

.modal-overlay{
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-bottom: 0 !important;
}

/* Filter-selection modals should behave like a bottom sheet (full width) */
#collections-modal,
#models-modal,
#backdrops-modal{
  /* rely on the base .modal-overlay layout; no extra "air" that creates visual gaps */
  padding-top: calc(0px + var(--tg-ios-topbar, 0px)) !important;
  padding-bottom: 0 !important;
  align-items: flex-end !important;
}

#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  border-radius: 26px 26px 0 0 !important;
  height: calc(100% - 4px) !important;
  max-height: calc(100% - 4px) !important;
}

/* 2) Filter trigger pills: allow wrapping instead of truncation */
.filter-btn{
  height: auto !important;
  min-height: 56px !important;
}
.filter-value,
.filter-value-text{
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word !important;
}

/* 3) Modal list names: never ellipsis, wrap instead */
.item-name{
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word !important;
}

/* 4) Inline reset pill: center text vertically */
.inline-reset-btn{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* =====================================================================
   Patch v30 (2026-01-07)
   Dolphin feedback:
   - НЕ переносить названия: всё в одну строку и без троеточий
   - "Очистить фильтр" показывать ТОЛЬКО когда есть активный фильтр
   - Равные отступы: между кнопками фильтров ↔ "Очистить фильтр" ↔ карточками
   - При скролле, когда сверху остаётся только меню фильтров — добавить больше воздуха сверху
   ===================================================================== */

/* 0) More top breathing room for sticky header states (when banner is scrolled away) */
main{
  padding-top: 12px !important;
}

/* 1) Sticky stack spacing: одинаково сверху/снизу */
:root{ --sticky-stack-gap: 8px; }

.sticky-filters{
  padding-top: 0 !important;
  padding-bottom: 0 !important; /* remove old extra bottom air */
}
.sticky-filters .filters-bar{ margin-bottom: var(--sticky-stack-gap) !important; }
.sticky-filters .advanced-panel{ margin-bottom: var(--sticky-stack-gap) !important; }
.sticky-filters .inline-reset-btn{
  margin-top: 0 !important;
  margin-bottom: var(--sticky-stack-gap) !important;
}

/* 2) Inline reset must be hidden by default; JS toggles --visible */
.inline-reset-btn{
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}
.inline-reset-btn.inline-reset-btn--visible{
  display: inline-flex !important;
}

/* 3) Filter triggers: one-line, no ellipsis, fit by design (smaller paddings/fonts) */
.filter-btn{
  height: 56px !important;
  min-height: 56px !important;
  padding: 10px 20px 10px 8px !important;
  overflow: hidden !important;
}
.filter-value{
  font-size: 13px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}
.filter-value-text{
  font-size: clamp(11px, 3.2vw, 12px) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}
.filters-bar .filter-value-icon{
  width: 20px !important;
  height: 20px !important;
  border-radius: 7px !important;
}

/* 4) Filter modals list names: one-line, no ellipsis, make room by shrinking chrome */
.item-icon{
  width: 42px !important;
  height: 42px !important;
  margin-right: 12px !important;
  border-radius: 12px !important;
}
.item-info{
  margin-right: 8px !important;
}
.item-price{
  min-width: 0 !important; /* do not steal width from the name */
}
.price-value-modal{
  font-size: 17px !important;
}
.item-name{
  font-size: clamp(14px, 4.0vw, 16px) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

/* =====================================================================
   Patch v31 (2026-01-07)
   Dolphin feedback:
   - Equal spacing around "Очистить фильтр" (same gap above/below)
   - No wrapping in the top filters row; truncate with ellipsis (dots) + safe padding from chevrons
   - Reduce excessive top empty space; raise top-right balance pill/+ block
   - Fix modal list name truncation (show full names; allow wrapping)
   - Make "Сбросить фильтры" in empty state look like a real button
   ===================================================================== */

:root{
  --sticky-stack-gap: 8px;
}

/* iOS Telegram: reduce reserved top space a bit (keeps content below native buttons but not too low) */
html.tg-webapp-ios{
  --tg-ios-topbar: 44px !important;
}

/* Overall top padding: raise everything slightly */
main{
  padding-top: 6px !important;
}
html.tg-webapp-ios main{
  padding-top: 4px !important;
}

/* ----- Sticky filters stack: consistent gaps ----- */
.sticky-filters{
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
.sticky-filters .filters-bar{
  margin-bottom: var(--sticky-stack-gap) !important;
}
/* Advanced panel should only add spacing when OPEN */
.sticky-filters .advanced-panel{
  margin-bottom: 0 !important;
}
.sticky-filters .advanced-panel.open{
  margin-bottom: var(--sticky-stack-gap) !important;
}
/* Clear-filter button: exact same spacing to the cards as to the menu above */
.inline-reset-btn{
  margin-top: 0 !important;
  margin-bottom: var(--sticky-stack-gap) !important;
}

/* ----- Top filters row: always ONE line (no wrap) ----- */
.filters-bar{
  flex-wrap: nowrap !important;
  align-items: stretch !important;
}

/* Pills: keep one-line text; ellipsis when needed */
.filters-bar .filter-btn{
  height: 56px !important;
  min-height: 56px !important;
  /* extra right padding so text never goes under chevrons */
  padding: 9px 36px 9px 10px !important;
  min-width: 0 !important;
}

/* Move chevrons a bit inward from the border */
.filters-bar .filter-btn::before,
.filters-bar .filter-btn::after{
  right: 14px !important;
}

/* Typography: keep labels/values in a single line */
.filters-bar .filter-label,
.filters-bar .filter-value{
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* When value is an icon + text pill */
.filters-bar .filter-value-pill{
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
  max-width: 100% !important;
  flex-wrap: nowrap !important;
}
.filters-bar .filter-value-text{
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Very small screens: shrink type a touch so most names fit without truncation */
@media (max-width: 360px){
  .filters-bar .filter-label{ font-size: 11px !important; }
  .filters-bar .filter-value{ font-size: 13px !important; }
  .filters-bar .filter-value-text{ font-size: 12.5px !important; }
  .filters-bar .filter-btn{ padding: 9px 34px 9px 8px !important; }
}

/* ----- Modal list items: do NOT shorten names ----- */
.item-name{
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
/* Give name more room (price column was stealing width) */
.item-price{
  min-width: 84px !important;
}
@media (max-width: 380px){
  .item-price{ min-width: 72px !important; }
}

/* ----- Empty state: make reset filters look like a button ----- */
.empty-state #reset-filters-btn.btn-outline,
.empty-state .btn-outline{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 12px 18px !important;
  border-radius: 16px !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  background: rgba(255,255,255,0.05) !important;
}

/* =====================================================================
   Patch v31 (2026-01-07)
   Dolphin feedback:
   - Equal spacing around "Очистить фильтр" (same gap above/below)
   - Filters row: always one line; truncate with ellipsis + keep distance from chevrons
   - Reduce extra top empty space (iOS/Telegram); raise top widgets
   - Filter modals: do NOT shorten collection/model names
   - Empty state: "Сбросить фильтры" must look like a button
   ===================================================================== */

:root{
  --sticky-stack-gap: 8px;
}

/* 1) Top padding: remove the extra empty area that pushed everything too low */
main{
  padding-top: 6px !important;
}
html.tg-webapp-ios{
  /* Previously 56px created a visibly "empty" header area on many devices */
  --tg-ios-topbar: 44px !important;
}

/* 2) Sticky stack spacing: equal gap above/below the inline reset button */
.sticky-filters{
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
.sticky-filters .filters-bar{
  margin-bottom: var(--sticky-stack-gap) !important;
}
/* Advanced panel must NOT add spacing when closed */
.sticky-filters .advanced-panel{
  margin-bottom: 0 !important;
}
.sticky-filters .advanced-panel.open{
  margin-bottom: var(--sticky-stack-gap) !important;
}
.inline-reset-btn{
  margin-top: 0 !important;
  margin-bottom: var(--sticky-stack-gap) !important;
}

/* 3) Filters row (top pills): ALWAYS one row; safe padding for arrows; ellipsis with dots */
.filters-bar{
  flex-wrap: nowrap !important;
}

.filters-bar .filter-btn{
  /* Reserve space for chevrons + keep border away from them */
  padding-right: 40px !important;
}

/* Move chevrons slightly inward so they don't stick to the border */
.filter-btn::before,
.filter-btn::after{
  right: 14px !important;
}

/* Prevent value/label from wrapping and ensure ellipsis appears */
.filters-bar .filter-label,
.filters-bar .filter-value{
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
}

/* When we render icon + text inside the value, the text must be allowed to shrink */
.filter-value-pill{
  max-width: 100% !important;
  min-width: 0 !important;
  flex-wrap: nowrap !important;
}
.filter-value-text{
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Extra-tight mode for the smallest widths so pills still fit in one row */
@media (max-width: 360px){
  .filters-bar{ gap: 6px !important; }
  .filters-bar .filter-btn{ padding: 9px 36px 9px 10px !important; }
  .filters-bar .filter-label{ font-size: 11px !important; }
  .filters-bar .filter-value{ font-size: 13px !important; }
  .filters-bar .filter-value-text{ font-size: 12px !important; }
}

/* 4) Modal lists: do NOT shorten names (no ellipsis). Allow wrapping. */
.item-name{
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
.item-info{
  min-width: 0 !important;
}
@media (max-width: 520px){
  /* Give a bit more room to the name by not forcing a wide price column */
  .item-price{ min-width: 84px !important; }
}

/* 5) Empty state: make reset button look like a real button */
.empty-state .btn-outline,
#reset-filters-btn.btn-outline{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  background: rgba(255, 255, 255, 0.05) !important;
}


/* v31 hotfix: iOS needs slightly tighter top padding */
html.tg-webapp-ios main{ padding-top: 4px !important; }
html.tg-webapp-ios .topbar{
  padding-top: calc(0px + 8px) !important;
  padding-bottom: 8px !important;
}

/* =====================================================================
   Patch v32 (2026-01-07)
   Dolphin feedback:
   - Filter modals: show FULL names in ONE line
     (no wrap / no ellipsis / no clipping).
   - Give text more horizontal room (shrink checkbox/icon/price columns).
   - Payment sheets: centered, not stretched (including balance modal).
   ===================================================================== */

/* Balance (payment) modal: keep centered like other payment sheets */
#balance-modal .modal{
  width: min(420px, calc(100% - 28px)) !important;
  max-width: 420px !important;
  border-radius: 24px !important;
  margin: 0 auto calc(12px + 0px) !important;
}

/* Filter list rows: tighten the fixed columns so names fit on small widths */
#collections-modal .modal-item,
#models-modal .modal-item,
#backdrops-modal .modal-item{
  padding: 10px 12px !important;
  min-height: 70px !important;
}

#collections-modal .modal-check,
#models-modal .modal-check,
#backdrops-modal .modal-check{
  width: 22px !important;
  height: 22px !important;
  border-radius: 9px !important;
  margin-right: 8px !important;
  border-width: 1.4px !important;
}

#collections-modal .item-icon,
#models-modal .item-icon,
#backdrops-modal .item-icon{
  width: 40px !important;
  height: 40px !important;
  margin-right: 10px !important;
  border-radius: 14px !important;
}

#collections-modal .item-info,
#models-modal .item-info,
#backdrops-modal .item-info{
  margin-right: 8px !important;
  min-width: 0 !important;
}

/* Names: one line, no dots, no wrapping */
#collections-modal .item-name,
#models-modal .item-name,
#backdrops-modal .item-name{
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Price: narrow column; allow the label to wrap inside its own column */
#collections-modal .item-price,
#models-modal .item-price,
#backdrops-modal .item-price{
  min-width: 64px !important;
  width: 64px !important;
}

#collections-modal .price-value-modal,
#models-modal .price-value-modal,
#backdrops-modal .price-value-modal{
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
}

#collections-modal .price-label,
#models-modal .price-label,
#backdrops-modal .price-label{
  font-size: 10px !important;
  line-height: 1.05 !important;
  white-space: normal !important;
  word-break: break-word !important;
}

/* Filter triggers (top pills): no truncation / no ellipsis for selected names */
.filters-bar .filter-label,
.filters-bar .filter-value,
.filters-bar .filter-value-text{
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Slightly smaller type so full names fit even on narrow WebApps */
.filters-bar .filter-label{ font-size: 10px !important; }
.filters-bar .filter-value,
.filters-bar .filter-value-text{ font-size: 12px !important; }

/* =====================================================================
   Patch v33 (2026-01-07)
   Dolphin feedback:
   - When scrolling, NO grid content should "peek" above the sticky filters row.
     (It happened because main had top padding; content scrolls into that padding.)
   - Keep a small, pleasant top breathing room when only the filters are visible,
     but it must be the sticky block's own background (not scroll padding).
   ===================================================================== */

/* Remove top padding from the scroll container so content can't slide into it */
main{ padding-top: 0 !important; }
html.tg-webapp-ios main{ padding-top: 0 !important; }

/* Add the breathing room INSIDE the sticky bar so nothing shows above it */
.sticky-filters{ padding-top: 6px !important; }
html.tg-webapp-ios .sticky-filters{ padding-top: 4px !important; }

/* =====================================================================
   Patch v34 (2026-01-07)
   Dolphin feedback (screens):
   - Filter modals (collections/models/backdrops): typography + spacing like reference
   - Search field: same placement + size
   - Rows: bigger avatar, name, price; min-price label smaller
   - Top filter pills (single selection): bigger photo, clean ellipsis, SF Pro everywhere
   ===================================================================== */

/* 0) SF PRO ONLY: every glyph must use SF Pro Display (no fallback flashes) */
:root{ --font-sans: "SF Pro Display" !important; }
html, body,
button, input, textarea, select,
*, *::before, *::after{
  font-family: "SF Pro Display" !important;
  font-synthesis: none !important;
}
input::placeholder, textarea::placeholder{
  font-family: "SF Pro Display" !important;
}

/* 1) Filter modals header typography */
#collections-modal .modal-header,
#models-modal .modal-header,
#backdrops-modal .modal-header{
  padding: 18px 18px 12px !important;
}

#collections-modal .modal-title,
#models-modal .modal-title,
#backdrops-modal .modal-title{
  font-size: 28px !important;
  line-height: 1.12 !important;
  letter-spacing: -0.02em !important;
  margin-bottom: 6px !important;
  font-weight: 700 !important;
}

#collections-modal .modal-subtitle,
#models-modal .modal-subtitle,
#backdrops-modal .modal-subtitle{
  font-size: 15px !important;
  line-height: 1.35 !important;
  padding-bottom: 0 !important;
}

/* 2) Search field placement + sizing */
#collections-modal .modal-search,
#models-modal .modal-search,
#backdrops-modal .modal-search{
  padding: 0 18px 10px !important;
}

#collections-modal .modal-search .search-input,
#models-modal .modal-search .search-input,
#backdrops-modal .modal-search .search-input{
  height: 46px !important;
  border-radius: 16px !important;
  font-size: 15px !important;
  padding-left: 44px !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  color: rgba(255,255,255,0.92) !important;
  background-position: 16px 50% !important;
  background-size: 16px 16px !important;
}

/* 3) Filter list rows: sizes like the reference (no tiny text) */
#collections-modal .modal-item,
#models-modal .modal-item,
#backdrops-modal .modal-item{
  padding: 12px 18px !important;
  min-height: 74px !important;
}

#collections-modal .modal-check,
#models-modal .modal-check,
#backdrops-modal .modal-check{
  width: 26px !important;
  height: 26px !important;
  border-radius: 999px !important;
  margin-right: 12px !important;
  border-width: 1.6px !important;
  background: transparent !important;
}

#collections-modal .modal-item.selected .modal-check,
#models-modal .modal-item.selected .modal-check,
#backdrops-modal .modal-item.selected .modal-check{
  background: var(--tg-accent) !important;
  border-color: var(--tg-accent) !important;
}

#collections-modal .modal-check-icon,
#models-modal .modal-check-icon,
#backdrops-modal .modal-check-icon{
  width: 15px !important;
  height: 11px !important;
}

#collections-modal .item-icon,
#models-modal .item-icon,
#backdrops-modal .item-icon{
  width: 46px !important;
  height: 46px !important;
  border-radius: 14px !important;
  margin-right: 14px !important;
}

#collections-modal .item-info,
#models-modal .item-info,
#backdrops-modal .item-info{
  min-height: 46px !important;
  justify-content: center !important;
  margin-right: 12px !important;
}

#collections-modal .item-name,
#models-modal .item-name,
#backdrops-modal .item-name{
  font-size: 17px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#collections-modal .item-price,
#models-modal .item-price,
#backdrops-modal .item-price{
  min-width: 104px !important;
}

#collections-modal .price-value-modal,
#models-modal .price-value-modal,
#backdrops-modal .price-value-modal{
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  margin-bottom: 2px !important;
  letter-spacing: -0.01em !important;
  font-variant-numeric: tabular-nums !important;
}

#collections-modal .price-label,
#models-modal .price-label,
#backdrops-modal .price-label{
  font-size: 12px !important;
  line-height: 1.15 !important;
  opacity: 0.78 !important;
  white-space: nowrap !important;
}

/* 4) Top filter pills (single selection): bigger photo + clean ellipsis */
.filters-bar .filter-label{
  font-size: 12px !important;
  line-height: 1.2 !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.filters-bar .filter-value{
  font-size: 14px !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.filters-bar .filter-btn{ padding-right: 36px !important; }
.filters-bar .filter-btn:not(#advanced-trigger)::before,
.filters-bar .filter-btn:not(#advanced-trigger)::after{
  width: 8px !important;
  height: 8px !important;
  border-right-width: 2px !important;
  border-bottom-width: 2px !important;
  right: 14px !important;
}

.filters-bar .filter-value-pill{ gap: 8px !important; }
.filters-bar .filter-value-icon{
  width: 28px !important;
  height: 28px !important;
  border-radius: 10px !important;
}
.filters-bar .filter-value-icon img{
  width: 100% !important;
  height: 100% !important;
  border-radius: inherit !important;
  object-fit: cover !important;
}
.filters-bar .filter-value-text{
  font-size: 14px !important;
  font-weight: 700 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}



/* =====================================================================
   Patch v36 (2026-01-07)
   Dolphin feedback:
   - After applying filters / reset: scroll MUST go to the absolute top (balance area) [JS]
   - Close icons: move closer to the edge and keep PERFECT alignment across all menus
   - Checkboxes: square (like the reference), not round
   - Modal search inputs: same grey as the modal, not lighter
   - Animations: noticeably smoother + longer (no "blink" / no ultra-fast transitions)
   ===================================================================== */

:root{
  --ui-menu-ms: 520ms !important;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1) !important; /* iOS-like ease-out */
}

@media (prefers-reduced-motion: reduce){
  :root{ --ui-menu-ms: 0ms !important; }
  *, *::before, *::after{ transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* -----------------
   1) Close buttons
   ----------------- */

.modal-header{ position: relative !important; }

.modal-title-wrap{
  padding-right: 56px !important; /* room for ✕ */
}

.modal-overlay .modal-close-btn,
.gift-sheet .gift-sheet-close,
.gift-sheet .result-sheet-close,
.tonkeeper-sheet .tonkeeper-close{
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  margin: 0 !important;
}

/* Keep the tap target stable */
.modal-overlay .modal-close-btn,
.gift-sheet .gift-sheet-close,
.gift-sheet .result-sheet-close,
.tonkeeper-sheet .tonkeeper-close{
  width: 34px !important;
  height: 34px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

/* -----------------
   2) Checkbox shape
   ----------------- */

#collections-modal .modal-check,
#models-modal .modal-check,
#backdrops-modal .modal-check{
  border-radius: 8px !important; /* square, like the reference */
}

#collections-modal .modal-check-icon,
#models-modal .modal-check-icon,
#backdrops-modal .modal-check-icon{
  transform: scale(0.92) !important;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out) !important;
  opacity: 0 !important;
}

#collections-modal .modal-item.selected .modal-check-icon,
#models-modal .modal-item.selected .modal-check-icon,
#backdrops-modal .modal-item.selected .modal-check-icon{
  opacity: 1 !important;
  transform: scale(1) !important;
}

#collections-modal .modal-check,
#models-modal .modal-check,
#backdrops-modal .modal-check{
  transition: background-color 220ms var(--ease-out), border-color 220ms var(--ease-out) !important;
}

/* -----------------
   3) Modal search input background
   ----------------- */

#collections-modal .modal-search .search-input,
#models-modal .modal-search .search-input,
#backdrops-modal .modal-search .search-input{
  background-color: var(--tg-bg-elevated) !important; /* same as modal */
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
}

/* -----------------
   4) Higher-quality motion (menus/sheets/overlays)
   ----------------- */

/* Overlays fade */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay{
  transition: opacity var(--ui-menu-ms) var(--ease-out),
              visibility 0ms linear var(--ui-menu-ms) !important;
  will-change: opacity;
}

/* Modal sheet (collections/models/backdrops): slide from bottom (noticeable, smooth) */
.modal-overlay .modal{
  transform: translate3d(0, 100%, 0) !important;
  opacity: 0.4 !important;
  transition: transform var(--ui-menu-ms) var(--ease-out),
              opacity var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform, opacity;
}
.modal-overlay.open .modal{
  transform: translate3d(0, 0, 0) !important;
  opacity: 1 !important;
}
.modal-overlay.closing .modal{
  transform: translate3d(0, 100%, 0) !important;
  opacity: 0.4 !important;
}

/* Gift / pay / result sheets */
.gift-sheet,
.pay-sheet,
.result-sheet,
.tonkeeper-sheet{
  transform: translate3d(0, 100%, 0) !important;
  opacity: 0.4 !important;
  transition: transform var(--ui-menu-ms) var(--ease-out),
              opacity var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform, opacity;
}

.gift-sheet.open,
.pay-sheet.open,
.result-sheet.open,
.tonkeeper-overlay.visible .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) !important;
  opacity: 1 !important;
}

/* Close animation for Tonkeeper overlay */
.tonkeeper-overlay.closing .tonkeeper-sheet{
  transform: translate3d(0, 100%, 0) !important;
  opacity: 0.4 !important;
}


/* Crisp text after transitions (Telegram WebView can blur while transformed) */
.modal-overlay.open.settled .modal{
  transform: none !important;
}
.gift-sheet-overlay.settled .gift-sheet.open,
.gift-sheet-overlay.settled .pay-sheet.open,
.gift-sheet-overlay.settled .result-sheet.open{
  transform: none !important;
}
.tonkeeper-overlay.settled .tonkeeper-sheet{
  transform: none !important;
}


.modal-overlay.settled .modal,
.gift-sheet-overlay.settled .gift-sheet,
.gift-sheet-overlay.settled .pay-sheet,
.gift-sheet-overlay.settled .result-sheet,
.tonkeeper-overlay.settled .tonkeeper-sheet{
  transition: none !important;
}

/* =====================================================================
   Patch v37 (2026-01-07)
   Dolphin QA fixes:
   - No "transparent shadow" ghosting before/after animations: sheets stay fully opaque
   - Advanced # search panel must push the grid immediately (no overlay over gifts)
   - Backdrops modal: round preview must not be clipped at the bottom
   - Slightly reduce max gift size on very wide layouts
   ===================================================================== */

/* 1) Sheets should never animate in a semi-transparent state */
.modal-overlay .modal,
.modal-overlay.open .modal,
.modal-overlay.closing .modal{
  opacity: 1 !important;
  transition-property: transform !important;
}

.tonkeeper-overlay .tonkeeper-sheet,
.tonkeeper-overlay.visible .tonkeeper-sheet,
.tonkeeper-overlay.closing .tonkeeper-sheet{
  opacity: 1 !important;
  transition-property: transform !important;
}
.modal,
.gift-sheet,
.result-sheet,
.pay-sheet,
.tonkeeper-sheet{
  opacity: 1 !important;
  transition-property: transform !important;
  /* keep timing consistent across stacks */
  transition-duration: var(--ui-menu-ms, 280ms) !important;
  transition-timing-function: var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  will-change: transform;
  backface-visibility: hidden;
}

/* Remove heavy shadows that can leave trails during transforms */
.modal,
.gift-sheet,
.result-sheet,
.pay-sheet,
.tonkeeper-sheet{
  box-shadow: none !important;
}

/* 2) Advanced panel: animate HEIGHT (layout) + keep overflow hidden to prevent overlay */
.advanced-panel{
  max-height: none !important;
  height: 0;
  overflow: hidden !important;
  /* no fade: must be opaque from the start of the animation */
  opacity: 1 !important;
  pointer-events: none;
  transform: translateY(-4px) !important;
  transition: height var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
              transform var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  will-change: height, transform;
}
.advanced-panel.open{
  pointer-events: auto;
  max-height: none !important;
  transform: translateY(0) !important;
  /* keep overflow hidden so first frame can't paint outside the panel */
  overflow: hidden !important;
}
.advanced-panel.closing{
  pointer-events: none;
  max-height: none !important;
  transform: translateY(-4px) !important;
  overflow: hidden !important;
}

/* 3) Backdrops modal: avoid the round swatch being cut by exact-fit layout */
#backdrops-modal .modal-item{
  /* add 2px breathing room so the circle doesn't touch the separator */
  padding-top: 13px !important;
  padding-bottom: 13px !important;
  min-height: 82px !important;
}
#backdrops-modal .item-icon{
  width: 52px !important;
  height: 52px !important;
}

/* 4) Slightly reduce max gift size on wide screens */
.gift-grid{
  justify-items: center;
}
.gift-card{
  width: 100%;
  max-width: 320px; /* slightly smaller max when the WebApp is stretched */
  justify-self: center;
}
@media (max-width: 520px){
  .gift-card{ max-width: none; }
}

.tonkeeper-overlay{
  padding-left: 16px !important;
  padding-right: 16px !important;
}
.tonkeeper-sheet,
.tonkeeper-sheet--confirm{
  width: min(420px, calc(100% - 32px)) !important;
  max-width: 420px !important;
  border-radius: 24px !important;
  margin: 0 auto !important; /* true center inside the overlay flex */
}

/* =====================================================================
   Patch v38 (2026-01-07)
   Dolphin QA follow-ups:
   - Menus: stronger dim + blur, but NO opacity-based animations (no fade)
   - Advanced search panel: add extra gap under input when open
   - Backdrops/filters lists: paint an opaque scroll surface to avoid "pixel trails"
   - Tonkeeper/topup: override html.tg-webapp full-width regression
   ===================================================================== */

/* 1) Stronger backdrop and blur for ANY menu overlay (no fade animations) */
:root{
  --menu-backdrop-bg: rgba(0, 0, 0, 0.78);
  --menu-backdrop-blur: 14px;
}

.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay,
#payment-success-overlay,
#payment-fail-overlay,
.maintenance-overlay{
  background: var(--menu-backdrop-bg) !important;
  backdrop-filter: blur(var(--menu-backdrop-blur)) !important;
  -webkit-backdrop-filter: blur(var(--menu-backdrop-blur)) !important;
  /* No opacity animation at all */
  opacity: 1 !important;
  transition: none !important;
  will-change: auto !important;
}

/* Modal overlay: hide/show via visibility only */
.modal-overlay[aria-hidden="true"]{
  visibility: hidden !important;
  pointer-events: none !important;
}
.modal-overlay[aria-hidden="false"]{
  visibility: visible !important;
}
.modal-overlay.open{ pointer-events: auto !important; }
.modal-overlay.closing{ pointer-events: none !important; }

/* Gift/pay overlays: rely on aria-hidden; keep pointer-events only while "visible" */
.gift-sheet-overlay[aria-hidden="true"],
.pay-sheet-overlay[aria-hidden="true"]{
  visibility: hidden !important;
  pointer-events: none !important;
}
.gift-sheet-overlay[aria-hidden="false"],
.pay-sheet-overlay[aria-hidden="false"]{
  visibility: visible !important;
}
.gift-sheet-overlay.visible,
.pay-sheet-overlay.visible{ pointer-events: auto !important; }

/* Tonkeeper overlays: same (aria-hidden controls visibility) */
.tonkeeper-overlay[aria-hidden="true"]{
  visibility: hidden !important;
  pointer-events: none !important;
}
.tonkeeper-overlay[aria-hidden="false"]{
  visibility: visible !important;
}
.tonkeeper-overlay.visible{ pointer-events: auto !important; }
.tonkeeper-overlay.closing{ pointer-events: none !important; }

/* 2) Extra breathing room under the advanced input ONLY when open */
.sticky-filters .advanced-panel.open{
  margin-bottom: 14px !important;
}

/* 3) Fix "pixel" trails in scrollable filter lists: force opaque paint surface */
#collections-modal .modal-list,
#models-modal .modal-list,
#backdrops-modal .modal-list{
  background: #282727 !important;
}

/* 4) No transparency-based animation for checkmarks: animate scale only */
#collections-modal .modal-check-icon,
#models-modal .modal-check-icon,
#backdrops-modal .modal-check-icon{
  opacity: 1 !important;
  transform: scale(0) !important;
  transition: transform 180ms var(--ease-out) !important;
}

#collections-modal .modal-item.selected .modal-check-icon,
#models-modal .modal-item.selected .modal-check-icon,
#backdrops-modal .modal-item.selected .modal-check-icon{
  transform: scale(1) !important;
}

/* 5) Tonkeeper/topup: override Telegram full-width rules */
html.tg-webapp .tonkeeper-overlay{
  padding-left: 16px !important;
  padding-right: 16px !important;
}
html.tg-webapp .tonkeeper-sheet,
html.tg-webapp .tonkeeper-sheet--confirm{
  width: min(420px, calc(100% - 32px)) !important;
  max-width: 420px !important;
  margin: 0 auto !important;
  border-radius: 24px !important;
}


/* =====================================================================
   Patch v39 (2026-01-08)
   Dolphin QA final:
   - Normalize vertical spacing (banner / filters / search / reset)
   - Unify menu backdrops (moderate dim + blur)
   - Remove opacity-based animations everywhere (no fades)
   ===================================================================== */

:root{
  --ui-stack-gap: 10px;
  /* uniform menu backdrop across ALL menus */
  --menu-backdrop-bg: rgba(0, 0, 0, 0.66);
  --menu-backdrop-blur: 10px;
}

/* Banner spacing */
#top-banner{
  margin-bottom: var(--ui-stack-gap) !important;
}

/* Sticky filters spacing (keeps consistent spacing to grid even when search is open) */
.sticky-filters{
  padding-bottom: var(--ui-stack-gap) !important;
}
.sticky-filters .filters-bar{
  margin-bottom: 0 !important;
}
.sticky-filters .advanced-panel{
  margin: 0 !important;
}
.sticky-filters .advanced-panel.open{
  margin-top: var(--ui-stack-gap) !important;
  margin-bottom: 0 !important; /* override previous "extra breathing room" */
}
.sticky-filters .inline-reset-btn{
  margin: 0 !important;
}
.sticky-filters .inline-reset-btn.inline-reset-btn--visible{
  margin-top: var(--ui-stack-gap) !important;
}

/* Search clear button: show/hide via display (no opacity fade) */
.advanced-search .search-clear{
  display: none !important;
  opacity: 1 !important;
  transition: none !important;
}
.advanced-search .search-clear.visible{
  display: flex !important;
}

/* Gift sheet preview: hide via visibility (no opacity fade) */
.gift-sheet-preview-img.is-hidden{
  visibility: hidden !important;
}

/* Pull-to-refresh indicator: no opacity transitions */
.ptr-indicator{
  transition: none !important;
}

/* As a safeguard: never animate opacity on menus */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay,
#payment-success-overlay,
#payment-fail-overlay,
.maintenance-overlay{
  transition: none !important;
}

/* Toast: slide only (no fade) */
.toast{
  opacity: 1 !important;
  transition: transform 180ms var(--ease-out) !important;
  visibility: hidden !important;
}
.toast.visible{
  visibility: visible !important;
}


/* =====================================================================
   Patch v40 (2026-01-08)
   - Remove translucency during sheet animations (no opacity animations)
   - Backdrop is a separate layer (overlay never fades children)
   - Top-up menus: remove blur
   - Advanced search panel: prevent overlap when раскрывается
   - iOS: disable expensive blur to reduce lag on system auto-dim
   ===================================================================== */

:root{
  --ui-backdrop-ms: 160ms;
}

/* Keep overlays themselves fully opaque; backdrop is drawn via ::before */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay,
#payment-success-overlay,
#payment-fail-overlay,
#purchase-cancel-overlay,
#price-change-overlay,
.maintenance-overlay{
  background: transparent !important;
  opacity: 1 !important;
  transition: none !important;
}

/* Backdrop layer */
.modal-overlay::before,
.gift-sheet-overlay::before,
.pay-sheet-overlay::before,
.tonkeeper-overlay::before,
#payment-success-overlay::before,
#payment-fail-overlay::before,
#purchase-cancel-overlay::before,
#price-change-overlay::before,
.maintenance-overlay::before{
  content:"";
  position:absolute;
  inset:0;
  background: var(--menu-backdrop-bg, rgba(0,0,0,0.72));
  opacity: 0;
  pointer-events:none;
  transition: opacity var(--ui-backdrop-ms) var(--ease-out);
  backdrop-filter: blur(var(--menu-backdrop-blur, 12px));
  -webkit-backdrop-filter: blur(var(--menu-backdrop-blur, 12px));
}

/* Backdrop visible while overlay is open/visible */
.modal-overlay.open::before{ opacity: 1; }
.gift-sheet-overlay.visible::before{ opacity: 1; }
.pay-sheet-overlay.visible::before{ opacity: 1; }
.tonkeeper-overlay.visible::before{ opacity: 1; }
#payment-success-overlay.visible::before{ opacity: 1; }
#payment-fail-overlay.visible::before{ opacity: 1; }
#purchase-cancel-overlay.visible::before{ opacity: 1; }
#price-change-overlay.visible::before{ opacity: 1; }

/* Close order: backdrop fades out first (closing class forces opacity 0) */
.modal-overlay.closing::before,
.gift-sheet-overlay.closing::before,
.pay-sheet-overlay.closing::before,
.tonkeeper-overlay.closing::before,
#payment-success-overlay.closing::before,
#payment-fail-overlay.closing::before,
#purchase-cancel-overlay.closing::before,
#price-change-overlay.closing::before{
  opacity: 0 !important;
}

/* Ensure overlay remains visible while aria-hidden=false (even if .visible was removed for fading) */
.gift-sheet-overlay[aria-hidden="false"],
.pay-sheet-overlay[aria-hidden="false"],
.tonkeeper-overlay[aria-hidden="false"],
#payment-success-overlay[aria-hidden="false"],
#payment-fail-overlay[aria-hidden="false"],
#purchase-cancel-overlay[aria-hidden="false"],
#price-change-overlay[aria-hidden="false"]{
  visibility: visible !important;
}
.gift-sheet-overlay[aria-hidden="true"],
.pay-sheet-overlay[aria-hidden="true"],
.tonkeeper-overlay[aria-hidden="true"],
#payment-success-overlay[aria-hidden="true"],
#payment-fail-overlay[aria-hidden="true"],
#purchase-cancel-overlay[aria-hidden="true"],
#price-change-overlay[aria-hidden="true"]{
  visibility: hidden !important;
}

/* Pointer-events: only when active */
.gift-sheet-overlay.visible,
.pay-sheet-overlay.visible,
.tonkeeper-overlay.visible,
#payment-success-overlay.visible,
#payment-fail-overlay.visible,
#purchase-cancel-overlay.visible,
#price-change-overlay.visible{
  pointer-events: auto !important;
}
.gift-sheet-overlay.closing,
.pay-sheet-overlay.closing,
.tonkeeper-overlay.closing,
#payment-success-overlay.closing,
#payment-fail-overlay.closing,
#purchase-cancel-overlay.closing,
#price-change-overlay.closing{
  pointer-events: none !important;
}

/* Sheets must stay fully opaque during transitions (fix "see-through" in animations) */
.modal,
.gift-sheet,
.pay-sheet,
.result-sheet,
.tonkeeper-sheet{
  opacity: 1 !important;
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform;
}

/* Closed states (default is translateY(100%) in existing CSS; keep explicit here for safety) */
.gift-sheet,
.pay-sheet,
.result-sheet,
.tonkeeper-sheet{
  transform: translate3d(0, 100%, 0) !important;
}

/* Open states */
.gift-sheet.open,
.pay-sheet.open,
.result-sheet.open,
.tonkeeper-sheet.open{
  transform: translate3d(0, 0, 0) !important;
}

/* Top-up menus: remove blur (requested) */
#topup-menu-overlay::before,
#payment-confirm-overlay::before{
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* iOS: disable blur on all backdrops to avoid "hyper-lag" on system dim/off */
html.tg-webapp-ios .modal-overlay::before,
html.tg-webapp-ios .gift-sheet-overlay::before,
html.tg-webapp-ios .pay-sheet-overlay::before,
html.tg-webapp-ios .tonkeeper-overlay::before,
html.tg-webapp-ios #payment-success-overlay::before,
html.tg-webapp-ios #payment-fail-overlay::before,
html.tg-webapp-ios #purchase-cancel-overlay::before,
html.tg-webapp-ios #price-change-overlay::before{
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Advanced search panel: remove negative translate that causes overlap + add gap */
#sticky-filters .advanced-panel{
  transform: none !important;
  margin-top: 10px !important;
}
#sticky-filters .advanced-panel.open{
  transform: none !important;
}
#sticky-filters .filters-bar{
  position: relative;
  z-index: 3;
}
#sticky-filters .advanced-panel{
  position: relative;
  z-index: 2;
}


/* =====================================================================
   Patch v41 (2026-01-08)
   Dolphin QA:
   - Remove ALL blur from the entire app (no backdrop-filter anywhere)
   - Prevent background scroll when payment/top-up menus are open
   ===================================================================== */

/* Kill blur globally (user request: no blur in the app at all). */
:root{ --menu-backdrop-blur: 0px !important; }
*,
*::before,
*::after{
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Extra safety: while any overlay is open, the main scroller must not scroll. */
html.overlay-open main,
html.overlay-open #ptr-content{
  overflow: hidden !important;
  touch-action: none !important;
}


/* =====================================================================
   Patch v42 (2026-01-08)
   Dolphin QA:
   - Do NOT kill sticky top bar when overlays are open (no overflow:hidden on main)
   - Remove opacity/backdrop fade (no "transparent" animation), keep only slide
   - Make payment/top-up sheets slide from bottom (not appear in center)
   - Fix uneven spacing between filters/reset button and cards
   ===================================================================== */

/* 1) Keep the main scroller as a real scroll container while overlays are open
      (otherwise position:sticky stops working and the filter bar "disappears"). */
html.overlay-open main,
html.overlay-open #ptr-content{
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* 2) No fade/opacity animation on dark backdrops (only slide for sheets). */
.modal-overlay,
.gift-sheet-overlay,
.result-sheet-overlay,
.tonkeeper-overlay{
  transition: none !important;
}
.modal-overlay::before,
.gift-sheet-overlay::before,
.result-sheet-overlay::before,
.tonkeeper-overlay::before{
  transition: none !important;
  opacity: 1 !important;
}

/* 3) Bottom-sheet positioning for pay sheets (price change, etc.). */
.pay-sheet{
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 auto !important;
  width: min(520px, 100%) !important;
  max-width: 520px !important;
  border-radius: 22px 22px 0 0 !important;
  transform: translate3d(0, 100%, 0) !important;
}
.pay-sheet.open{
  transform: translate3d(0, 0, 0) !important;
}

/* 4) Bottom-sheet positioning for top-up / tonkeeper menus. */
.tonkeeper-overlay{
  align-items: flex-end !important;
  justify-content: center !important;
}
.tonkeeper-sheet{
  width: min(520px, 100%) !important;
  max-width: 520px !important;
  border-radius: 22px 22px 0 0 !important;
  margin: 0 auto !important;
  transform: translate3d(0, 100%, 0) !important;
  transition: transform var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
}
.tonkeeper-overlay.visible .tonkeeper-sheet{ transform: translate3d(0, 0, 0) !important; }
.tonkeeper-overlay.closing .tonkeeper-sheet{ transform: translate3d(0, 100%, 0) !important; }

/* 5) Consistent spacing between filters, reset button and cards. */
:root{ --sticky-stack-gap: 10px; }
#sticky-filters{ padding-bottom: 0 !important; }
#sticky-filters .filters-bar{ margin-bottom: var(--sticky-stack-gap) !important; }
#sticky-filters .advanced-panel{ margin-top: var(--sticky-stack-gap) !important; margin-bottom: 0 !important; }
#sticky-filters .advanced-panel.open{ margin-bottom: var(--sticky-stack-gap) !important; }
#sticky-filters .inline-reset-btn{ margin: 0 0 var(--sticky-stack-gap) 0 !important; }
#gift-grid{ margin-top: 0 !important; padding-top: 0 !important; }



/* Telegram Stars: paymode toggle inside quick top-up sheet (only shown on shortage flow) */
.quick-topup-paymode {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 10px;
}

.quick-topup-paymode-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 800;
  min-width: 52px;
}

.quick-topup-paymode-btn.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

.quick-topup-receive {
  width: 100%;
  margin: 6px 0 12px;
  font-size: 13px;
  line-height: 16px;
  color: rgba(255, 255, 255, 0.72);
}

#quick-topup-receive-amount {
  font-weight: 900;
  color: rgba(255, 255, 255, 0.92);
}


/* Star icon (Telegram Stars) */
.tg-star-icon{
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -3px;
}
.tg-star-inline{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: -3px;
}
.tg-star-inline img{
  width: 100%;
  height: 100%;
  display:block;
}
.quick-topup-paymode-btn img.tg-star-icon{
  vertical-align: middle;
}

/* =============================================================================
   FINAL OVERRIDES - All Bottom Sheets & Overlays
   ============================================================================= */

/* Prevent scrollbar flash when overlay opens */
html.overlay-open,
html.overlay-open body {
  overflow: hidden !important;
}

/* ===== ALL BOTTOM SHEETS: Slide from bottom, no bottom radius ===== */

/* Tonkeeper overlay (topup menu) */
.tonkeeper-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 9999 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: none !important;
  overflow: hidden !important;
}

.tonkeeper-overlay.visible {
  pointer-events: auto !important;
  visibility: visible !important;
}

.tonkeeper-overlay.closing {
  pointer-events: none !important;
  visibility: visible !important;
}

/* Tonkeeper sheet - slides from bottom */
.tonkeeper-sheet {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 360px !important;
  max-height: 85vh !important;
  overflow-y: auto !important;
  background: #1c1c1e !important;
  border-radius: 20px 20px 0 0 !important;
  border: none !important;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5) !important;
  padding: 20px 20px calc(20px + 0px) !important;
  margin: 0 !important;
  transform: translateY(100%) !important;
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1) !important;
  will-change: transform !important;
}

.tonkeeper-overlay.visible .tonkeeper-sheet {
  transform: translateY(0) !important;
}

.tonkeeper-overlay.closing .tonkeeper-sheet {
  transform: translateY(100%) !important;
}

/* Close button - proper X */
.tonkeeper-close {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  cursor: pointer !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  overflow: hidden !important;
}

.tonkeeper-close::before,
.tonkeeper-close::after {
  content: "" !important;
  position: absolute !important;
  width: 16px !important;
  height: 2px !important;
  background: rgba(255, 255, 255, 0.7) !important;
  border-radius: 1px !important;
  left: 50% !important;
  top: 50% !important;
}

.tonkeeper-close::before {
  transform: translate(-50%, -50%) rotate(45deg) !important;
}

.tonkeeper-close::after {
  transform: translate(-50%, -50%) rotate(-45deg) !important;
}

/* Title */
.tonkeeper-title {
  font-size: 20px !important;
  font-weight: 700 !important;
  text-align: center !important;
  margin: 8px 0 16px !important;
  color: #fff !important;
}

/* Purse animation */
.tonkeeper-purse {
  width: 140px !important;
  height: 110px !important;
  margin: 0 auto 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Payment mode selector - fixed width buttons to prevent layout shift */
.quick-topup-paymode {
  display: flex !important;
  gap: 8px !important;
  margin: 12px auto !important;
  justify-content: center !important;
}

.quick-topup-paymode-btn {
  width: 56px !important;
  height: 40px !important;
  padding: 0 !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.6) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.quick-topup-paymode-btn.is-active,
.quick-topup-paymode-btn.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Input */
.tonkeeper-input-wrap {
  margin: 16px 0 !important;
}

.tonkeeper-field {
  position: relative !important;
}

.tonkeeper-input {
  width: 100% !important;
  height: 56px !important;
  padding: 0 50px 0 20px !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 16px !important;
  outline: none !important;
  box-sizing: border-box !important;
}

.tonkeeper-input:focus {
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.tonkeeper-currency {
  position: absolute !important;
  right: 20px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.4) !important;
  pointer-events: none !important;
}

/* Submit button */
.tonkeeper-btn {
  width: 100% !important;
  height: 56px !important;
  margin-top: 16px !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  color: #fff !important;
  background: #007AFF !important;
  border: none !important;
  border-radius: 14px !important;
  cursor: pointer !important;
}

.tonkeeper-btn:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

/* Receive amount text - fixed height */
.quick-topup-receive {
  text-align: center !important;
  font-size: 14px !important;
  color: rgba(255, 255, 255, 0.5) !important;
  margin: 8px 0 !important;
  min-height: 20px !important;
}

/* Shortage block */
#quick-topup-shortage {
  margin: 12px 0 !important;
  padding: 14px !important;
  background: rgba(255, 59, 48, 0.1) !important;
  border: 1px solid rgba(255, 59, 48, 0.2) !important;
  border-radius: 14px !important;
}

/* ===== MODAL OVERLAYS: No opacity transitions ===== */

.modal-overlay {
  transition: none !important;
}

.modal-overlay .modal {
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1) !important;
}

.modal-overlay.open .modal {
  transform: translateY(0) !important;
}

.modal-overlay.closing .modal {
  transform: translateY(100%) !important;
}

/* Gift sheet overlay - no opacity */
.gift-sheet-overlay {
  transition: none !important;
}

.gift-sheet-overlay .gift-sheet {
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1) !important;
}

.gift-sheet-overlay.visible .gift-sheet {
  transform: translateY(0) !important;
}

.gift-sheet-overlay.closing .gift-sheet {
  transform: translateY(100%) !important;
}

/* Pay sheet overlay - no opacity */
.pay-sheet-overlay {
  transition: none !important;
}

.pay-sheet-overlay .pay-sheet {
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1) !important;
}

.pay-sheet-overlay.visible .pay-sheet {
  transform: translateY(0) !important;
}

.pay-sheet-overlay.closing .pay-sheet {
  transform: translateY(100%) !important;
}

/* Remove bottom radius from all bottom sheets */
.modal,
.gift-sheet,
.pay-sheet,
.result-sheet,
#purchase-cancel-sheet {
  border-radius: 20px 20px 0 0 !important;
}

/* ===== SCROLL TO TOP BUTTON ===== */

.scroll-top-btn {
  position: fixed !important;
  bottom: calc(24px + 0px) !important;
  right: 16px !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  background: #007AFF !important;
  border: none !important;
  color: #fff !important;
  font-size: 0 !important;
  cursor: pointer !important;
  z-index: 1000 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

.scroll-top-btn.visible {
  display: flex !important;
}

.scroll-top-btn-icon {
  font-size: 20px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.scroll-top-btn:active {
  transform: scale(0.92) !important;
}

/* ===== CLOSE BUTTON FINAL FIX ===== */
#topup-menu-sheet .tonkeeper-close,
#payment-confirm-sheet .tonkeeper-close,
.tonkeeper-overlay .tonkeeper-close {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.1) !important;
  cursor: pointer !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  /* Hide any text content */
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
}

#topup-menu-sheet .tonkeeper-close::before,
#topup-menu-sheet .tonkeeper-close::after,
#payment-confirm-sheet .tonkeeper-close::before,
#payment-confirm-sheet .tonkeeper-close::after,
.tonkeeper-overlay .tonkeeper-close::before,
.tonkeeper-overlay .tonkeeper-close::after {
  content: "" !important;
  position: absolute !important;
  width: 14px !important;
  height: 2px !important;
  background: rgba(255, 255, 255, 0.8) !important;
  border-radius: 1px !important;
  left: 50% !important;
  top: 50% !important;
  text-indent: 0 !important;
}

#topup-menu-sheet .tonkeeper-close::before,
#payment-confirm-sheet .tonkeeper-close::before,
.tonkeeper-overlay .tonkeeper-close::before {
  transform: translate(-50%, -50%) rotate(45deg) !important;
}

#topup-menu-sheet .tonkeeper-close::after,
#payment-confirm-sheet .tonkeeper-close::after,
.tonkeeper-overlay .tonkeeper-close::after {
  transform: translate(-50%, -50%) rotate(-45deg) !important;
}

/* Modal close button fix */
.modal .modal-close-btn {
  color: transparent !important;
  font-size: 0 !important;
  text-indent: -9999px !important;
}

.modal .modal-close-btn::before,
.modal .modal-close-btn::after {
  content: "" !important;
  position: absolute !important;
  width: 16px !important;
  height: 2px !important;
  background: rgba(255, 255, 255, 0.7) !important;
  border-radius: 1px !important;
  left: 50% !important;
  top: 50% !important;
}

.modal .modal-close-btn::before {
  transform: translate(-50%, -50%) rotate(45deg) !important;
}

.modal .modal-close-btn::after {
  transform: translate(-50%, -50%) rotate(-45deg) !important;
}

/* =====================================================================
   Patch v21 (2026-01-10)
   - Filters: close/open animation like gift sheet (slide from/to bottom)
   - Top-up menu: centered + appears (scale/fade), not a bottom sheet
   - Top-up menu: keep size fixed ("Вы получите … ₽" row no longer changes height)
   ===================================================================== */

/* 1) Filters modals: use the same slide animation as the gift sheet */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  transform: translate3d(0, 110%, 0) !important;
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform;
}
#collections-modal.open .modal,
#models-modal.open .modal,
#backdrops-modal.open .modal{
  transform: translate3d(0, 0, 0) !important;
}
#collections-modal.closing .modal,
#models-modal.closing .modal,
#backdrops-modal.closing .modal{
  transform: translate3d(0, 110%, 0) !important;
}
#collections-modal.settled .modal,
#models-modal.settled .modal,
#backdrops-modal.settled .modal{
  transform: none !important;
  will-change: auto !important;
}

/* 2) Top-up menu overlay: center + appear (scale/fade), not slide from bottom */
#topup-menu-overlay{
  align-items: center !important;
  justify-content: center !important;
}
#topup-menu-overlay .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) scale(0.94) !important;
  opacity: 0 !important;
  transition: transform var(--ui-menu-ms) var(--ease-out), opacity var(--ui-menu-ms) var(--ease-out) !important;
  will-change: transform, opacity;
}
#topup-menu-overlay.visible .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) scale(1) !important;
  opacity: 1 !important;
}
#topup-menu-overlay.closing .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) scale(0.94) !important;
  opacity: 0 !important;
}
#topup-menu-overlay.settled .tonkeeper-sheet{
  transform: none !important;
  opacity: 1 !important;
  will-change: auto !important;
}

/* 3) Keep top-up menu height stable when toggling Stars/RUB */
#quick-topup-receive{
  opacity: 1 !important;
  visibility: visible !important;
}
#quick-topup-receive[hidden]{
  /* Override UA [hidden]{display:none} so layout height stays constant */
  display: block !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ========================================================================
   Patch v43 (UI polish from screenshots)
   - Filter modals close like gift sheet (backdrop hides first, then sheet slides)
   - Advanced search input: slide-in/out animation + spacing fix only while focused
   - Top-up menu proportions (no circle on close, less empty space, balanced sizes)
   ======================================================================== */

.modal-overlay,
.gift-sheet-overlay{
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Gift sheet itself should hug the WebApp edges (rounded only on top). */
.gift-sheet:not(.result-sheet){
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 24px 24px 0 0 !important;
}

/* 2) Filter modals: make the closing animation match the gift sheet.
   - Backdrop disappears immediately when closing starts
   - Sheet slides down only after `.open` is removed (happens on next frame)
*/
.modal-overlay{
  background: transparent !important; /* use ::before as the backdrop */
}

/* Ensure the backdrop is controlled via ::before (some older patches forced opacity=1). */
.modal-overlay::before{
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.55) !important;
  opacity: 0 !important;
  transition: none !important;
}
.modal-overlay.open::before{ opacity: 1 !important; }
/* Key: when closing starts (while `.open` is still present for 1 frame), hide backdrop first. */
.modal-overlay.closing::before{ opacity: 0 !important; }

/* Slide behavior: keep the sheet in place while both `.closing` and `.open` are present. */
.modal-overlay .modal{
  transform: translate3d(0, 110%, 0) !important;
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1) !important;
}
.modal-overlay.open .modal{ transform: translate3d(0, 0, 0) !important; }
.modal-overlay.closing.open .modal{ transform: translate3d(0, 0, 0) !important; }
.modal-overlay.closing:not(.open) .modal{ transform: translate3d(0, 110%, 0) !important; }

/* 3) Advanced search input: slide in/out (instead of “рисуется”).
   JS animates panel height; we animate the inner row for a “выдвижение” feel.
*/
#advanced-panel .advanced-search{
  transform: translate3d(0, -10px, 0);
  opacity: 0;
  transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1), opacity 180ms linear;
  will-change: transform, opacity;
}
#advanced-panel.open .advanced-search{
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

/* Spacing fix only for the problematic state: when the input is focused (focus-within).
   (Other distances remain unchanged.) */
#sticky-filters .advanced-panel.open:focus-within{
  margin-bottom: 14px !important;
}

/* 4) Top-up menu proportions (3rd screenshot).
   Keep centered + “appear” animation (handled above), but tune the layout.
*/
#topup-menu-sheet{
  /* Stop it from behaving like a huge bottom sheet */
  width: min(420px, calc(100% - 32px)) !important;
  max-width: 420px !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 18px 18px 16px !important;
  border-radius: 22px !important;
}

/* Close: remove the visible circle but keep a comfortable tap area */
#topup-menu-sheet .tonkeeper-close{
  background: transparent !important;
  border-radius: 0 !important;
}
#topup-menu-sheet .tonkeeper-close:hover{
  background: rgba(255,255,255,0.06) !important;
  border-radius: 12px !important;
}

/* Purse (bag) a bit bigger, title a bit smaller */
#topup-menu-sheet .tonkeeper-purse{
  width: 160px !important;
  height: 128px !important;
  margin: 0 auto 6px !important;
}
#topup-menu-sheet .tonkeeper-title{
  font-size: 20px !important;
  margin: 6px 0 12px !important;
}

/* Reduce empty space and make input/button feel tighter */
#topup-menu-sheet .tonkeeper-input-wrap{ margin: 12px 0 12px !important; }
#topup-menu-sheet .tonkeeper-input{
  height: 48px !important;
  font-size: 24px !important;
  border-radius: 14px !important;
  padding: 0 46px 0 16px !important;
}
#topup-menu-sheet .tonkeeper-currency{
  right: 16px !important;
  font-size: 18px !important;
}
#topup-menu-sheet .tonkeeper-btn{
  height: 50px !important;
  margin-top: 12px !important;
  font-size: 17px !important;
  border-radius: 14px !important;
}

/* Keep the “Вы получите … ₽” line from resizing the menu (no wrapping). */
#topup-menu-sheet #quick-topup-receive{
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-height: 20px !important;
}


/* ========================================================================
   Patch v44 (Stars receive card + remove close animations + square grey buttons)
   ======================================================================== */

/* Stars receive: clearer "what you'll get" card */
#quick-topup-receive.quick-topup-receive{
  margin: 10px 0 12px !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  color: rgba(255,255,255,0.78) !important;
}
#quick-topup-receive .quick-topup-receive-title{
  font-size: 12px !important;
  line-height: 14px !important;
  margin: 0 0 6px 0 !important;
  color: rgba(255,255,255,0.72) !important;
}
#quick-topup-receive .quick-topup-receive-value{
  font-size: 24px !important;
  line-height: 28px !important;
  font-weight: 900 !important;
  letter-spacing: -0.2px !important;
  color: rgba(255,255,255,0.94) !important;
}
#quick-topup-receive #quick-topup-receive-amount{
  font-weight: 900 !important;
  color: rgba(255,255,255,0.94) !important;
}
#quick-topup-receive .quick-topup-receive-meta{
  margin-top: 8px !important;
  font-size: 12px !important;
  line-height: 14px !important;
  color: rgba(255,255,255,0.66) !important;
}

/* Keep menu height stable when the receive card is hidden */
#quick-topup-receive[hidden]{
  /* Override UA [hidden]{display:none} so layout height stays constant */
  display: block !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Remove close/open animations that can freeze scrolling in Telegram WebViews */
.gift-sheet,
.modal,
.tonkeeper-sheet,
.advanced-panel{
  transition: none !important;
  animation: none !important;
}

/* Advanced panel: no slide/opacity animation */
.advanced-panel{ 
  will-change: auto !important; 
}

/* Up/advanced trigger button: more square + grey, no rotation animation */
#advanced-trigger{
  border-radius: 12px !important;
  background: rgba(255,255,255,0.08) !important;
  border-color: rgba(255,255,255,0.12) !important;
  color: rgba(255,255,255,0.82) !important;
}
#advanced-trigger::before{
  transition: none !important;
}
#advanced-trigger.active{
  background: rgba(255,255,255,0.12) !important;
  border-color: rgba(255,255,255,0.18) !important;
  color: rgba(255,255,255,0.94) !important;
}

/* Scroll-to-top: square + grey */
.scroll-top-btn{
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  color: rgba(255,255,255,0.92) !important;
  border-radius: 12px !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.32) !important;
}

/* ========================================================================
   Patch v45 (Quick topup hint row + stable sheet height + spacing fixes)
   ======================================================================== */

/* Filter buttons: visually even top/bottom padding (fixes "снизу меньше") */
.filters-bar .filter-btn{
  padding-top: 8px !important;
  padding-bottom: 12px !important;
}

/* Gift sheet close: absolutely no fade/slide transitions (prevents scroll lock feel) */
.gift-sheet-overlay,
.gift-sheet-overlay::before,
.gift-sheet,
.pay-sheet-overlay,
.pay-sheet-overlay::before,
.pay-sheet,
.tonkeeper-overlay,
.tonkeeper-overlay::before,
.tonkeeper-sheet,
.modal-overlay,
.modal-overlay::before,
.modal{
  transition: none !important;
  animation: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

/* Modal overlays: never turn into a black blurred blob */
.modal-overlay{
  background: transparent !important;
}
.modal{
  background: rgba(30,30,30,0.96) !important;
}

/* Topup menu: fixed size between RUB/STARS modes */
#topup-menu-sheet{
  height: min(420px, calc(100vh - 40px)) !important;
  display: flex !important;
  flex-direction: column !important;
}

#topup-menu-sheet .tonkeeper-purse{
  width: 220px !important;
  height: 170px !important;
  margin: 0 auto 8px !important;
}

#topup-menu-sheet .tonkeeper-title{
  margin: 6px 0 10px !important;
}

/* Quick topup hint (rate + computed "= ... ₽") */
#quick-topup-hint.quick-topup-hint{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 8px;
  min-height: 24px;
  padding: 0 2px;
  font-size: 13px;
  line-height: 16px;
  color: rgba(255,255,255,0.70);
}
#quick-topup-hint .quick-topup-hint-left{
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#quick-topup-hint .quick-topup-hint-right{
  flex: 0 0 auto;
  font-weight: 800;
  color: rgba(255,255,255,0.92);
}
#quick-topup-hint[hidden]{
  /* Keep layout height stable (sheet size doesn't jump), but make it invisible */
  display: flex !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Make the lottie fill the purse block */
#topup-menu-sheet .tonkeeper-purse canvas,
#topup-menu-sheet .tonkeeper-purse svg{
  width: 100% !important;
  height: 100% !important;
}


/* Extra vertical gap between filter row and search (matches top padding visually) */
#sticky-filters .filters-bar{
  margin-bottom: 12px !important;
}
#sticky-filters .advanced-panel{
  margin-top: 0 !important;
}

/* ========================================================================
   Patch v46 (2026-01-10)
   Dolphin QA:
   - Fix filter modals "black/blur" glitch (disable backdrop-filter)
   - Fix advanced search input being visually cut
   - Topup Stars: hide hint row (amount is shown in the button), enlarge purse
   ======================================================================== */

/* 1) Filter modals: no backdrop blur (Telegram WebView can glitch to black/blurred surface). */
#collections-modal.modal-overlay,
#models-modal.modal-overlay,
#backdrops-modal.modal-overlay{
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: transparent !important; /* backdrop handled by ::before */
}

/* 2) Advanced panel: prevent clipping/overlap when toggled (open = normal flow). */
#advanced-panel.advanced-panel{
  max-height: none !important;
}
#advanced-panel.advanced-panel.open{
  /* height is driven by JS for smooth open/close */
  margin-bottom: 12px !important;
}
#advanced-panel.advanced-panel:not(.open){
  margin-bottom: 0 !important;
}

/* 3) Topup: hide hint row entirely (CTA shows credited amount). */
#quick-topup-hint{ display: none !important; }

/* 4) Topup: animation should occupy most of the sheet. */
#topup-menu-sheet .tonkeeper-purse{
  width: 260px !important;
  height: 200px !important;
  margin: 0 auto 10px !important;
}


/* ========================================================================
   Patch v47 (2026-01-11)
   Dolphin QA:
   - Filter pill text sits slightly above center -> nudge down
   - Advanced panel: keep overflow hidden during height animation (no bleed)
   - Make all bottom-sheets use the same slide-in/out timing as filter menus
   ======================================================================== */

/* 1) Filter pills: optical vertical centering */
.filters-bar .filter-value-text,
.filters-bar .filter-value-count{
  transform: translateY(1px) !important;
}

/* 2) Advanced panel: during animated height change we MUST clip content */
#advanced-panel.advanced-panel,
#advanced-panel.advanced-panel.open{
  overflow: hidden !important;
}

/* 3) Unify slide transitions (open + close) across all bottom sheets */
.modal-overlay .modal,
.gift-sheet-overlay .gift-sheet,
.pay-sheet-overlay .pay-sheet{
  transition: transform var(--ui-menu-ms) var(--ease-out) !important;
}

/* ========================================================================
   Patch v48 (2026-01-11)
   Dolphin QA:
   - Advanced # search: no jumpy extra margin; stable bottom padding; smooth open/close
   - Top-up menu: should APPEAR (no slide transform) and not jitter on open
   ======================================================================== */

/* Advanced panel: remove external margin toggles (they cause a visible jump at the end of the animation),
   and add internal bottom padding so the input isn't visually clipped. */
#advanced-panel.advanced-panel{
  box-sizing: border-box !important;
  margin-bottom: 0 !important;
  padding: 0 0 12px 0 !important;

  /* Force height-based animation (older rules use max-height). */
  transition: height var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
              transform var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
}
#advanced-panel.advanced-panel.open,
#advanced-panel.advanced-panel.closing{
  margin-bottom: 0 !important;
}
#advanced-panel .advanced-search{
  margin-bottom: 0 !important;
}

/* Top-up (Tonkeeper): do NOT slide from the bottom — it should appear (as before).
   Slide animations on this sheet cause "jitter" when its internal rows toggle. */
.tonkeeper-overlay .tonkeeper-sheet,
.tonkeeper-overlay .tonkeeper-sheet--confirm,
.tonkeeper-overlay.visible .tonkeeper-sheet,
.tonkeeper-overlay.visible .tonkeeper-sheet--confirm,
.tonkeeper-overlay.closing .tonkeeper-sheet,
.tonkeeper-overlay.closing .tonkeeper-sheet--confirm,
.tonkeeper-overlay.settled .tonkeeper-sheet,
.tonkeeper-overlay.settled .tonkeeper-sheet--confirm{
  transform: none !important;
  transition: none !important;
  will-change: auto !important;
}

/* ========================================================================
   Patch v49 (2026-01-11)
   Dolphin QA:
   - Advanced panel: remove 1s “ghost gap” after close
   - Advanced panel: open should not feel like “content appears then it keeps expanding”
   - Keep a proper bottom breathing room so the input isn't visually cut
   ======================================================================== */

/* 1) Never keep padding on the panel itself (height animation uses inline `height`). */
#advanced-panel.advanced-panel{
  padding: 0 !important;
  margin-bottom: 0 !important;
}

/* 2) Add bottom breathing room ONLY while open/closing (doesn't affect closed layout).
      Using a pseudo-element avoids box-model issues (padding would add extra height even at height:0). */
#advanced-panel.advanced-panel::after{
  content: "";
  display: block;
  height: 0;
}
#advanced-panel.advanced-panel.open::after,
#advanced-panel.advanced-panel.closing::after{
  height: 12px;
}

/* 3) Inner row should animate with the SAME duration as the panel height.
      Also, when closing starts, fade/slide the row immediately (no lingering “top strip”). */
#advanced-panel .advanced-search{
  transform: translate3d(0, -6px, 0);
  opacity: 0;
  transition: transform var(--ui-menu-ms, 360ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
              opacity var(--ui-menu-ms, 360ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  will-change: transform, opacity;
}
#advanced-panel.open .advanced-search{
  transform: translate3d(0, 0, 0);
  opacity: 1;
}
#advanced-panel.closing .advanced-search{
  transform: translate3d(0, -6px, 0);
  opacity: 0;
}

/* 4) Prevent any focus-only margin hacks from reintroducing jumps. */
#sticky-filters .advanced-panel.open:focus-within{
  margin-bottom: 0 !important;
}


/* ========================================================================
   Patch v50 (2026-01-11)
   Dolphin QA:
   - Advanced panel: eliminate the last tiny scroll/anchor "jerk" at the end
   - Top-up menu: bigger purse animation + more noticeable (but still non-slide)
     appear animation, and no jitter (JS settle timer aligned with --ui-menu-ms)
   ======================================================================== */

/* 1) Prevent scroll anchoring from nudging the grid when the sticky header changes height */
#sticky-filters,
#advanced-panel{
  overflow-anchor: none !important;
}

/* 2) Top-up menu appear animation: stronger scale (still centered, no slide) */
#topup-menu-overlay .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) scale(0.86) !important;
}
#topup-menu-overlay.visible .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) scale(1) !important;
}
#topup-menu-overlay.closing .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) scale(0.86) !important;
}

/* 3) Make the top-up menu feel like a "big" popup: more screen coverage + big purse */
#topup-menu-sheet{
  width: min(560px, calc(100% - 20px)) !important;
  max-width: 560px !important;
  height: min(86vh, 760px) !important;
  max-height: 86vh !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

#topup-menu-sheet .tonkeeper-purse{
  width: min(420px, 100%) !important;
  height: clamp(260px, 40vh, 420px) !important;
  margin: 2px auto 6px !important;
  flex: 1 1 auto !important;
}

#topup-menu-sheet .tonkeeper-title{
  margin: 4px 0 12px !important;
}

#topup-menu-sheet #quick-topup-shortage{
  margin-top: 2px !important;
  margin-bottom: 10px !important;
}

#topup-menu-sheet #quick-topup-paymode{
  margin: 0 auto 10px !important;
}

#topup-menu-sheet .tonkeeper-input-wrap{
  margin: 10px 0 12px !important;
}

#topup-menu-sheet .tonkeeper-btn{
  margin-top: 10px !important;
}

/* When the keyboard opens (mobile), allow the user to reach the CTA. */
#topup-menu-sheet{
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}


/* ========================================================================
   Patch v51 (2026-01-11)
   Dolphin QA:
   - Tonkeeper confirm overlay: the waiting card must be perfectly centered
     (no visual drift due to asymmetric top padding)
     pay-mode toggle placed top-left as a proper switch
   - Advanced # input: remove the end-of-animation micro "jitter" by animating
     only height (no translate on the panel itself)
   ======================================================================== */

#payment-confirm-overlay.tonkeeper-overlay{
  /* Fallback first, then symmetric padding so the flex center is not shifted. */
  padding-top: 0px !important;
  padding-bottom: 0px !important;
  padding-top: max(0px, 0px) !important;
  padding-bottom: max(0px, 0px) !important;
  padding-left: 22px !important;
  padding-right: 22px !important;
  align-items: center !important;
  justify-content: center !important;
}

/* 2) Top-up menu (balance topup): bring back a compact popup */
#topup-menu-sheet{
  width: min(420px, calc(100% - 32px)) !important;
  max-width: 420px !important;
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  max-height: calc(100vh - 32px) !important;
  padding: 16px 16px 14px !important;
  border-radius: 22px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Proportional purse (lottie): not huge, no stretching */
#topup-menu-sheet .tonkeeper-purse{
  width: 180px !important;
  height: 140px !important;
  margin: 2px auto 8px !important;
  flex: 0 0 auto !important;
}
#topup-menu-sheet .tonkeeper-purse canvas,
#topup-menu-sheet .tonkeeper-purse svg{
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Pay-mode switch: top-left, like a real toggle (only appears on shortage flow) */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode{
  order: -10 !important;
  align-self: flex-start !important;
  width: auto !important;
  margin: 0 0 6px 0 !important;
  justify-content: flex-start !important;
  gap: 6px !important;
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn{
  width: 44px !important;
  height: 34px !important;
  border-radius: 10px !important;
  font-size: 15px !important;
}

/* Title: a touch smaller so the sheet doesn't feel oversized */
#topup-menu-sheet .tonkeeper-title{
  font-size: 20px !important;
  margin: 6px 0 12px !important;
}

/* 3) Advanced search panel: animate ONLY height (no translate) => no micro shake */
#advanced-panel.advanced-panel{
  transform: none !important;
  transition: height var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
  will-change: height !important;
}
#advanced-panel.advanced-panel.open,
#advanced-panel.advanced-panel.closing{
  transform: none !important;
}



/* ========================================================================
   Patch v52 (2026-01-11)
   Dolphin QA:
   - Top-up menu: remove forced min-height from global Tonkeeper sheet (fixes empty bottom space)
   - Pay-mode toggle: redesign as compact segmented switch in the top-left corner (doesn't push content)
   - Keyboard focus: use stable viewport height + keyboard inset padding to avoid the final "down jerk"
   - Confirm overlay: compact centered card (no forced min-height)
   ======================================================================== */

/* Top-up overlay: center, and account for keyboard inset without reflowing the whole app */
#topup-menu-overlay.tonkeeper-overlay{
  align-items: center !important;
  justify-content: center !important;
  height: var(--tg-viewport-stable-height, var(--tg-viewport-height, var(--app-height, 100vh))) !important;
  padding-top: max(0px, 16px) !important;
  padding-bottom: calc(max(0px, 16px) + var(--tg-keyboard-inset, 0px)) !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
}

/* Remove global bottom-sheet min-height & keep the top-up sheet compact */
#topup-menu-sheet{
  min-height: 0 !important;
  max-height: min(560px, calc(var(--tg-viewport-height, 100vh) - 24px)) !important;
}

/* Place the toggle in the header corner (only visible in shortage flow) */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode{
  position: absolute !important;
  top: 12px !important;
  left: 12px !important;
  margin: 0 !important;
  order: 0 !important;
  align-self: auto !important;
  justify-content: flex-start !important;
  width: auto !important;
  gap: 0 !important;
  padding: 2px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  z-index: 12 !important;
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn{
  width: 40px !important;
  height: 30px !important;
  border-radius: 10px !important;
  border: 0 !important;
  background: transparent !important;
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn.is-active,
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn.active{
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
}
#topup-menu-sheet #quick-topup-paymode .tg-star-mode-icon{
  width: 18px !important;
  height: 18px !important;
}

/* Keep close button aligned with the toggle */
#topup-menu-sheet .tonkeeper-close{
  top: 12px !important;
  right: 12px !important;
}

/* Confirm overlay: make the waiting card compact even if global Tonkeeper styles enforce min-height */
#payment-confirm-sheet{
  min-height: 0 !important;
  width: min(420px, calc(100% - 32px)) !important;
  max-width: 420px !important;
  max-height: min(340px, calc(var(--tg-viewport-height, 100vh) - 32px)) !important;
  border-radius: 22px !important;
  padding: 20px 20px 18px !important;
  overflow: hidden !important;
}

/* ========================================================================
   Patch v53 (2026-01-11)
   Dolphin QA:
   - Top-up menu: remove invisible rows that still reserve height (fixes "empty space")
   - Top-up menu: make purse animation bigger & proportional (no "squeezed" look)
   - Top-up menu: segmented pay switch to match the design + no layout shift
   - Advanced panel: remove transform animation (prevents subtle scale/jitter on iOS)
   ======================================================================== */

/* 1) Hidden rows in the top-up sheet must NOT reserve height */
#quick-topup-hint[hidden],
#quick-topup-shortage[hidden],
#quick-topup-paymode[hidden]{
  display: none !important;
}

/* 2) Keep the sheet height stable against keyboard, but don't stretch it */
#topup-menu-sheet{
  max-height: min(520px, calc(var(--tg-viewport-stable-height, var(--tg-viewport-height, 100vh)) - 32px)) !important;
}

/* 3) Purse animation: larger, proportional, centered */
#topup-menu-sheet .tonkeeper-purse{
  width: min(260px, 72vw) !important;
  height: auto !important;
  aspect-ratio: 4 / 3;
  max-height: 220px !important;
  margin: 8px auto 10px !important;
}
#topup-menu-sheet .tonkeeper-purse canvas,
#topup-menu-sheet .tonkeeper-purse svg{
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Title spacing: tighter (no "random" gap) */
#topup-menu-sheet .tonkeeper-title{
  margin: 4px 0 10px !important;
}

/* Amount input: prevent iOS auto-zoom and keep typography consistent */
#topup-menu-sheet #quick-topup-amount{
  font-size: 18px !important;
}

/* 4) Pay-mode switch: true segmented control in the corner */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode{
  border-radius: 999px !important;
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn{
  border-radius: 999px !important;
  font-weight: 900 !important;
}

/* 5) Advanced panel: animate ONLY height + opacity (no translate => no tiny "scale" feel) */
main{ overflow-anchor: none !important; }

#advanced-panel .advanced-search{
  transform: none !important;
  will-change: opacity !important;
  transition: opacity var(--ui-menu-ms, 360ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  opacity: 0 !important;
}
#advanced-panel.open .advanced-search{ opacity: 1 !important; }
#advanced-panel.closing .advanced-search{ opacity: 0 !important; }

/* ========================================================================
   Patch v54 (2026-01-11)
   Dolphin QA:
   - Top-up menu: always show ₽/⭐ switch + ensure it stays above the animation
   - Top-up menu: reduce input height (was looking oversized)
   - iOS scroll: keep momentum + smoother repaint
   ======================================================================== */

/* Top-up switch should never be hidden behind the purse animation */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode{ z-index: 30 !important; }

/* Amount field: slightly smaller + cleaner proportions */
#topup-menu-sheet .tonkeeper-input{
  height: 48px !important;
  font-size: 16px !important;
  border-radius: 16px !important;
}
#topup-menu-sheet .tonkeeper-btn{ height: 50px !important; }


/* ========================================================================
   Patch v55 (2026-01-11)
   Dolphin QA:
   - Two purse animations (RUB + STARS) must play in sync; we only switch visibility.
   - Layered containers inside #topup-purse.
   ======================================================================== */

#topup-menu-sheet .tonkeeper-purse{
  position: relative !important;
  overflow: hidden !important;
}
#topup-menu-sheet .tonkeeper-purse .purse-layer{
  position: absolute !important;
  inset: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 120ms linear !important;
}
#topup-menu-sheet .tonkeeper-purse .purse-layer.is-active{
  opacity: 1 !important;
}
#topup-menu-sheet .tonkeeper-purse .purse-layer canvas,
#topup-menu-sheet .tonkeeper-purse .purse-layer svg{
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}


/* ========================================================================
   Patch v56 (2026-01-11)
   Dolphin QA:
   - Remove thin "white stripes" artifacts by switching purse renderer to SVG (JS) + square container.
   - Tighten spacing: smaller input, smaller gap to CTA.
   - Fix shortage line clipping + use real star icon (not emoji).
   - iOS scroll: make scrolling feel stable (avoid sticky/overflow-scrolling glitches).
   - Advanced panel: avoid "missing input" by not fading it with opacity.
   ======================================================================== */

/* Prevent subtle layout shift when scrollbars appear/disappear (desktop/Android webviews) */
main{ scrollbar-gutter: stable; }

/* iOS: momentum scrolling inside a fixed container + sticky headers can glitch (missing repaint).
   Use non-momentum scrolling for stability in Telegram iOS webviews. */
html.tg-webapp-ios main{ -webkit-overflow-scrolling: touch !important; }

/* Advanced search input should never be invisible; the height animation already hides it */
#advanced-panel .advanced-search{ opacity: 1 !important; transition: none !important; }

/* Top-up purse: square container so 512×512 animations keep correct proportions */
#topup-menu-sheet .tonkeeper-purse{
  width: 160px !important;
  height: 160px !important;
  margin: 6px auto 8px !important;
}

/* Input: smaller + less padding */
#topup-menu-sheet .tonkeeper-input-wrap{
  margin: 10px 0 8px !important;
}
#topup-menu-sheet .tonkeeper-input{
  height: 44px !important;
  font-size: 15px !important;
  padding: 0 44px 0 14px !important;
  border-radius: 14px !important;
}
#topup-menu-sheet .tonkeeper-currency{
  right: 14px !important;
  font-size: 15px !important;
}
#topup-menu-sheet .tg-star-icon{ width: 16px !important; height: 16px !important; }

/* CTA: bigger text (was looking tiny relative to the button) */
#topup-menu-sheet .tonkeeper-btn{
  height: 50px !important;
  font-size: 17px !important;
  line-height: 1.1 !important;
}

/* Shortage: prevent clipping + align icon nicely */
#topup-menu-sheet .balance-shortage-need{ line-height: 20px !important; }
#topup-menu-sheet #quick-topup-shortage-amount{
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

/* ──────────────────────────────────────────────────────────────────────────
   FIX: Sticky filters disappearing when opening a gift sheet while scrolled
   Cause: some "overlay-open" rules temporarily removed the scrolling context
   (overflow: hidden), which disables position: sticky.
   Keep the main scroller intact; background scroll is already blocked via
   overlay pointer-events + JS scroll guards.
   ────────────────────────────────────────────────────────────────────────── */
html.overlay-open main {
  overflow: auto !important;
  overflow-x: hidden !important;
}

/* =====================================================================
   Patch v57 (2026-01-13)
   Dolphin feedback:
     except payment menus/completion which may stay compact by height.
   ===================================================================== */

/* Remove global overlay horizontal gutters on phones */
html.tg-phone .modal-overlay,
html.tg-phone .gift-sheet-overlay,
html.tg-phone .pay-sheet-overlay {
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-bottom: 0 !important;
}

/* Default bottom sheets: flush to edges + bottom */
html.tg-phone .gift-sheet,
html.tg-phone #purchase-cancel-sheet.gift-sheet {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 26px 26px 0 0 !important;
}

/* Filter modals: full width + full height to the bottom */
html.tg-phone #collections-modal .modal,
html.tg-phone #models-modal .modal,
html.tg-phone #backdrops-modal .modal {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 26px 26px 0 0 !important;
}

/* Payment sheets: keep "card" height but make them full-width on phones */
html.tg-phone .gift-sheet-overlay .pay-sheet,
html.tg-phone .gift-sheet-overlay .result-sheet {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* =====================================================================
   Patch v58 (2026-01-13)
   Dolphin feedback:
   - Payment menus: tighten gap between input and CTA
   - Pay-mode switch: improved segmented control + animations
   - Toast: brighter + more noticeable animation
   ===================================================================== */

/* 1) Tighten spacing in Tonkeeper/top-up sheets */
.tonkeeper-sheet .tonkeeper-input-wrap{
  margin: 8px 0 6px !important;
}
.tonkeeper-sheet .tonkeeper-btn{
  margin-top: 6px !important;
}
/* Extra tight on the quick top-up sheet specifically */
#topup-menu-sheet .tonkeeper-input-wrap{
  margin: 8px 0 4px !important;
}
#topup-menu-sheet .tonkeeper-btn{
  margin-top: 6px !important;
}

/* 2) Pay-mode switch: moving indicator + pulse */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode{
  position: absolute !important;
  top: 12px !important;
  left: 12px !important;
  padding: 2px !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  gap: 0 !important;
}
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode::before{
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 40px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  transform: translateX(0);
  transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode[data-mode="STARS"]::before{
  transform: translateX(40px);
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn{
  position: relative !important;
  z-index: 1 !important;
  width: 40px !important;
  height: 30px !important;
  border-radius: 10px !important;
  border: 0 !important;
  background: transparent !important;
  transition: transform 120ms cubic-bezier(0.32, 0.72, 0, 1);
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn:active{
  transform: scale(0.96);
}
@keyframes quickTopupTogglePulse{
  0%{ transform: translateZ(0) scale(1); }
  35%{ transform: translateZ(0) scale(1.03); }
  100%{ transform: translateZ(0) scale(1); }
}
#topup-menu-sheet #quick-topup-paymode.mode-anim{
  animation: quickTopupTogglePulse 360ms cubic-bezier(0.32, 0.72, 0, 1);
}

#payment-success-overlay,
#payment-fail-overlay,
#price-change-overlay,
#purchase-cancel-overlay{
  padding: 0 !important;
  align-items: flex-end !important;
}
#payment-success-overlay .result-sheet,
#payment-fail-overlay .result-sheet,
#price-change-overlay .pay-sheet,
#purchase-cancel-overlay .gift-sheet{
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 26px 26px 0 0 !important;
  padding-bottom: calc(18px + 0px) !important;
}

/* Maintenance icon inside the fail sheet (when "Технические работы") */
.result-lottie .maintenance-mark{
  width: 92px;
  height: 92px;
  margin: 0 auto 12px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-size: 46px;
  animation: maintenanceBreath 1200ms cubic-bezier(0.32, 0.72, 0, 1) infinite;
}
@keyframes maintenanceBreath{
  0%{ transform: translateY(0) scale(1); }
  50%{ transform: translateY(-2px) scale(1.03); }
  100%{ transform: translateY(0) scale(1); }
}

/* 4) Toast: brighter + more noticeable (still no opacity animation) */
.toast{
  left: 16px !important;
  right: 16px !important;
  max-width: 520px !important;
  width: auto !important;
  margin: 0 auto !important;
  padding: 14px 16px !important;
  border-radius: 20px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55) !important;
  transform: translateY(-16px) scale(0.98) !important;
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1) !important;
}
.toast.visible{
  transform: translateY(0) scale(1) !important;
}
.toast.toast-pop{
  animation: toastPop 520ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes toastPop{
  0%{ transform: translateY(-16px) scale(0.96); }
  55%{ transform: translateY(0) scale(1.03); }
  100%{ transform: translateY(0) scale(1); }
}

.toast[data-type="success"]{ background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(255, 255, 255, 0.06)) !important; }
.toast[data-type="error"],
.toast[data-type="warning"]{ background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(255, 255, 255, 0.06)) !important; }
.toast[data-type="info"]{ background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(255, 255, 255, 0.06)) !important; }

html.tg-phone .toast{ max-width: none !important; }





/* =====================================================================
   Patch v46 (2026-01-13)
   Dolphin QA:
   - Fix overlay-open scroll lock: keep sticky island visible when gift sheet opens at bottom.
   - Fix pay-mode segmented control visual glitch.
   - Restore animation for #advanced-trigger and advanced-panel (#) expand.
   - Improve balance top-up notice visibility (bottom snackbar + balance pill flash).
   ===================================================================== */

/* 1) Overlay-open must NOT disable the main scroller/sticky UI.
      We lock BODY in JS, but keep MAIN as the scroll container so sticky headers don't "disappear". */
html.overlay-open main,
html.overlay-open #ptr-content{
  overflow-y: auto !important;
  overflow-x: hidden !important;
  touch-action: pan-y !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Ensure the sticky "island" always stays above grid content while sheets are open */
.sticky-filters{ z-index: 60 !important; }

/* 2) Quick top-up pay-mode: robust segmented control (no layout shift, no misaligned highlight) */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode{
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0 !important;
  padding: 2px !important;
  width: 92px !important;
  height: 34px !important;
  border-radius: 14px !important;
  overflow: hidden !important;
}
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode::before{
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  transform: translateX(0);
  transition: transform 240ms cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode[data-mode="STARS"]::before{
  transform: translateX(100%);
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn{
  flex: 1 1 0 !important;
  width: auto !important;
  height: 30px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 1 !important;
}

/* 3) Restore the "#" advanced panel animation and trigger arrow rotation */
.advanced-panel{
  transition: height var(--ui-menu-ms, 280ms) cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: height !important;
  overflow: hidden !important;
}
#advanced-trigger::before{
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1) !important;
}
#advanced-trigger:active{ transform: scale(0.98); }

/* 4) Toast = bottom snackbar (more noticeable, doesn't hide behind top UI) */
.toast{
  top: auto !important;
  bottom: calc(0px + 16px) !important;
  transform: translateY(16px) scale(0.98) !important;
}
.toast.visible{ transform: translateY(0) scale(1) !important; }
@keyframes toastPop{
  0%{ transform: translateY(18px) scale(0.96); }
  55%{ transform: translateY(0) scale(1.03); }
  100%{ transform: translateY(0) scale(1); }
}

/* Balance pill flash after successful credit */
.balance-pill.balance-pill--flash{
  animation: balancePillFlash 900ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes balancePillFlash{
  0%{ filter: brightness(1); }
  35%{ filter: brightness(1.35); }
  100%{ filter: brightness(1); }
}

/* =====================================================================
   Patch v57 (2026-01-13)
   Dolphin QA:
   - Pay-mode (₽ / ⭐) switch: pixel-perfect segmented control
     * remove outer outline
     * remove double highlight (button bg + indicator)
     * equal halves, aligned icons
   ===================================================================== */

/* Container: keep the capsule, but without the thin white outline */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode{
  width: 92px !important;
  height: 34px !important;
  padding: 2px !important;
  border: 0 !important; /* remove white stroke */
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
}

/* Moving highlight: use the SAME capsule radius, no extra edges */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode::before{
  border-radius: 999px !important;
}

/* Buttons: never draw their own background in active state (indicator is the only highlight) */
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn{
  border-radius: 999px !important;
  line-height: 1 !important;
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn.is-active,
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn.active{
  background: transparent !important;
  border: 0 !important;
}

/* Ensure the star icon sits dead-center (avoid baseline quirks) */
#topup-menu-sheet #quick-topup-paymode .tg-star-mode-icon{
  display: block !important;
}


/* =====================================================================
   Patch v59 (2026-01-14)
   Dolphin QA:
   - Pay-mode icons (₽ / ⭐): optical centering
   ===================================================================== */

#topup-menu-sheet #quick-topup-paymode .paymode-icon{
  width: 100%;
  height: 100%;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  pointer-events: none; /* clicks stay on the button */
}

/* RUB glyph usually looks a bit high in SF Pro → nudge down by 1px */
#topup-menu-sheet #quick-topup-paymode .paymode-icon--rub{
  font-size: 16px !important;
  font-weight: 900 !important;
  transform: translateY(1px);
}

/* Star bitmap looks a bit low → nudge up by 1px */
#topup-menu-sheet #quick-topup-paymode .paymode-icon--star .tg-star-mode-icon{
  width: 16px !important;
  height: 16px !important;
  display: block !important;
  transform: translateY(-1px);
}

/* Override the global TG inline baseline hack inside the segmented control */
#topup-menu-sheet #quick-topup-paymode .tg-star-icon{
  vertical-align: 0 !important;
}

/* =====================================================================
   Patch v60 (2026-01-14)
   Dolphin QA:
   - Pay-mode switch: real 50/50 segments (no hidden offsets from justify-content)
   - Icons: true center (strip padding/min-width + center via flex)
   ===================================================================== */

#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode{
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important; /* IMPORTANT: no centering gaps */
  gap: 0 !important;
  box-sizing: border-box !important;
}

/* Make the indicator always exactly half of the inner capsule */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode::before{
  top: 2px !important;
  left: 2px !important;
  width: calc((100% - 4px) / 2) !important;
  height: calc(100% - 4px) !important;
  border-radius: 999px !important;
}
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode[data-mode="STARS"]::before{
  transform: translateX(calc((100% - 4px) / 2)) !important;
}

/* Buttons: true 50/50 layout, zero padding, center content */
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn{
  flex: 1 1 0 !important;
  width: auto !important;
  height: calc(100% - 4px) !important;
  padding: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}

/* Icons: keep wrapper tight, then do tiny optical nudges */
#topup-menu-sheet #quick-topup-paymode .paymode-icon{
  width: auto !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

/* ₽: visually a bit left/down in this font → micro-nudge */
#topup-menu-sheet #quick-topup-paymode .paymode-icon--rub{
  font-size: 16px !important;
  font-weight: 900 !important;
  transform: translate(0.5px, 0.5px) !important;
}

/* ⭐: bitmap has a little extra top padding → micro-nudge up */
#topup-menu-sheet #quick-topup-paymode .paymode-icon--star .tg-star-mode-icon{
  width: 16px !important;
  height: 16px !important;
  display: block !important;
  transform: translateY(-0.5px) !important;
}

/* =====================================================================
   Patch v61 (2026-01-14)
   Dolphin QA:
   - Pay-mode switch must NOT "pulse" or resize/jitter when switching.
   - Icons (₽ / ⭐) must be perfectly centered and stable.
   ===================================================================== */

/* JS still may add/remove the class; keep it harmless */
#topup-menu-sheet #quick-topup-paymode.mode-anim{
  animation: none !important;
}

/* Remove press-scale & transform transitions that look like "jitter" */
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn{
  transition: color 160ms cubic-bezier(0.32, 0.72, 0, 1) !important;
  transform: none !important;
}
#topup-menu-sheet #quick-topup-paymode .quick-topup-paymode-btn:active{
  transform: none !important;
}

/* True center: the icon wrapper fills the whole segment */
#topup-menu-sheet #quick-topup-paymode .paymode-icon{
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  pointer-events: none;
}

/* Reset old micro-nudges to avoid "jumping" from subpixel rounding */
#topup-menu-sheet #quick-topup-paymode .paymode-icon--rub{
  font-size: 16px !important;
  font-weight: 800 !important;
  transform: translateX(1px) !important; /* optical center for ₽ */
}

#topup-menu-sheet #quick-topup-paymode .paymode-icon--star .tg-star-mode-icon{
  width: 16px !important;
  height: 16px !important;
  display: block !important;
  transform: none !important;
}

/* =====================================================================
   Patch v62 (2026-01-14)
   Dolphin QA:
   - Fix segmented indicator offset: in transforms, % is relative to the indicator itself.
     v60 used calc((100%-4px)/2) which moved the pill only ~1/4 of the capsule.
   - Make the highlight move exactly 1 segment (its own width) with translate3d(100%,0,0).
   ===================================================================== */

#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode::before{
  /* Ensure a deterministic base state */
  transform: translate3d(0, 0, 0) !important;
}

#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode[data-mode="STARS"]::before{
  /* Move exactly by the indicator's own width (= 1 segment) */
  transform: translate3d(100%, 0, 0) !important;
}


/* =====================================================================
   Patch v63 (2026-01-14)
   Dolphin QA:
   - Toast (баланс пополнен): always on top, fully opaque, smooth slide-in from the top.
   ===================================================================== */

.toast{
  position: fixed !important;
  top: calc(0px + 12px) !important;
  left: 16px !important;
  right: 16px !important;
  max-width: 520px !important;
  width: auto !important;
  margin: 0 auto !important;

  padding: 14px 16px !important;
  border-radius: 20px !important;

  /* Opaque background (no "glass" transparency) */
  background: var(--tg-bg-elevated) !important;
  border: 1px solid var(--tg-border) !important;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55) !important;

  z-index: 9999 !important;

  /* No fade: only slide */
  opacity: 1 !important;
  visibility: hidden !important;
  pointer-events: none !important;

  /* Start fully above the viewport, then slide down */
  transform: translateY(calc(-100% - 18px)) !important;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s linear 260ms !important;
  will-change: transform;
}

.toast.visible{
  visibility: visible !important;
  transform: translateY(0) !important;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s !important;
}

/* A bit of extra "pop" when a toast is retriggered */
.toast.toast-pop{
  animation: toastSlidePop 520ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toastSlidePop{
  0%{ transform: translateY(calc(-100% - 18px)) scale(0.98); }
  60%{ transform: translateY(0) scale(1.02); }
  100%{ transform: translateY(0) scale(1); }
}

/* Type colors (still opaque) */
.toast[data-type="success"]{
  background: #1b2a1f !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
}
.toast[data-type="error"],
.toast[data-type="warning"]{
  background: #2a1b1b !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
.toast[data-type="info"]{
  background: #1b2330 !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
}


/* =====================================================================
   Patch v64 (2026-01-14)
   Dolphin QA:
     When we moved the toast to the top (v63) without resetting bottom, the element
     became constrained by BOTH top and bottom → huge green panel.
   - Make the toast look like a neutral iOS notification banner (no green background).
   ===================================================================== */

/* Critical: avoid top+bottom constraints → keep it content-sized */
.toast{
  bottom: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

/* Neutral banner background; keep type as an accent, not the whole card */
.toast{
  background: var(--tg-bg-elevated) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.48) !important;
}

/* Remove the full-card colored backgrounds from v63 */
.toast[data-type]{
  background: var(--tg-bg-elevated) !important;
}

/* iOS-like: subtle left accent */
.toast[data-type="success"]{ border-left: 3px solid rgba(52, 199, 89, 0.9) !important; }
.toast[data-type="error"],
.toast[data-type="warning"]{ border-left: 3px solid rgba(255, 69, 58, 0.9) !important; }
.toast[data-type="info"]{ border-left: 3px solid rgba(10, 132, 255, 0.9) !important; }


/* =====================================================================
   Patch v65 (2026-01-14)
   Dolphin QA:
   - Make the balance top-up notification look 1:1 like an iOS banner.
   - Fix missing animations in some iOS/Telegram WebViews (force slide + fade).
   ===================================================================== */

/* Strong specificity to override earlier toast patches */
#toast.toast{
  /* Placement */
  position: fixed !important;
  top: calc(0px + 10px) !important;
  left: 12px !important;
  right: 12px !important;
  bottom: auto !important;
  margin: 0 auto !important;
  max-width: 480px !important;
  width: auto !important;

  /* Layout: iOS banner */
  display: grid !important;
  grid-template-columns: 34px 1fr !important;
  column-gap: 12px !important;
  align-items: start !important;

  padding: 12px 14px !important;
  border-radius: 22px !important;

  /* iOS-like glass */
  background: rgba(24, 24, 24, 0.72) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45) !important;
  -webkit-backdrop-filter: blur(26px) saturate(180%) !important;
  backdrop-filter: blur(26px) saturate(180%) !important;

  color: rgba(255, 255, 255, 0.96) !important;
  z-index: 99999 !important;

  /* Hide state */
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate3d(0, calc(-100% - 16px), 0) !important;
  transition:
    transform 520ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important,
    opacity 200ms ease-out !important,
    visibility 0s linear 520ms !important;
  will-change: transform, opacity !important;

  /* Kill legacy accent styles */
  border-left: none !important;
  height: auto !important;
  min-height: 0 !important;
}

#toast.toast.visible{
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate3d(0, 0, 0) !important;
  transition:
    transform 520ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important,
    opacity 200ms ease-out !important,
    visibility 0s linear 0ms !important;
}

/* iOS banner sub-structure */
#toast.toast .toast-icon{
  width: 34px !important;
  height: 34px !important;
  border-radius: 9px !important;
  background: rgba(255, 255, 255, 0.16) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10) !important;
}
#toast.toast .toast-emoji{
  font-size: 16px !important;
  line-height: 1 !important;
  transform: none !important;
}
#toast.toast .toast-content{ min-width: 0 !important; }

#toast.toast .toast-header{
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  margin: 1px 0 2px 0 !important;
}
#toast.toast .toast-app{
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.2px !important;
  color: rgba(255, 255, 255, 0.86) !important;
}
#toast.toast .toast-time{
  font-size: 12px !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.60) !important;
}
#toast.toast .toast-text{
  font-size: 14px !important;
  font-weight: 700 !important;
  color: rgba(255, 255, 255, 0.96) !important;
  line-height: 1.25 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
}

@media (max-width: 380px){
  #toast.toast{ left: 10px !important; right: 10px !important; }
}


/* =====================================================================
   Patch v66 (2026-01-14)
   Dolphin feedback:
   - Do not clip the banner at the rounded WebView corners (add more side inset).
   - On iPhone Telegram: keep the banner BELOW native top controls (Close/… row).
   - Icon: only a big checkmark (no square background / borders).
   - Header label: GiftPay.
   ===================================================================== */

/* Placement fixes: respect iOS Telegram top controls + extra side insets */
#toast.toast{
  top: calc(
    0px
    + var(--tg-ios-topbar, 0px)
    + 10px
  ) !important;

  /* Telegram WebView has rounded corners that can clip fixed banners.
     Keep a bigger inset so the banner never touches those corners. */
  left: max(18px, 0px) !important;
  right: max(18px, 0px) !important;

  max-width: 560px !important;
  grid-template-columns: 26px 1fr !important;
  column-gap: 12px !important;
}

/* iOS Telegram: slightly more inset to avoid clipping near the top rounded corners */
html.tg-webapp-ios #toast.toast{
  left: max(22px, 0px) !important;
  right: max(22px, 0px) !important;
}

/* Small phones: keep comfortable inset but don't waste too much width */
@media (max-width: 380px){
  #toast.toast{ left: max(16px, 0px) !important; right: max(16px, 0px) !important; }
  html.tg-webapp-ios #toast.toast{ left: max(18px, 0px) !important; right: max(18px, 0px) !important; }
}

/* Icon: a plain checkmark (no square background) */
#toast.toast .toast-icon{
  width: 26px !important;
  height: 26px !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  margin-top: 2px !important;
}

#toast.toast .toast-emoji{
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  color: rgba(255, 255, 255, 0.98) !important;
}



/* =====================================================================
   Patch v67 (2026-01-14)
   Dolphin feedback:
   - Center the checkmark properly (no baseline drift).
   - Ensure hide uses a smooth exit animation (no instant disappear) in iOS Telegram.
   ===================================================================== */

/* Center the left icon relative to the content block */
#toast.toast{
  align-items: center !important; /* was start */
}

/* Make the checkmark reliably centered */
#toast.toast .toast-icon{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: center !important;
  margin-top: 0 !important;
}

/* Glyph baseline correction (fonts differ; this keeps ✓ visually centered) */
#toast.toast .toast-emoji{
  display: block !important;
  line-height: 1 !important;
  transform: translateY(1px) !important;
}

/* Prefer keyframe animations for enter/exit (Telegram iOS can snap transitions) */
#toast.toast{
  transition: none !important;
}

@keyframes iosBannerIn{
  0%   { opacity: 0; transform: translate3d(0, calc(-100% - 16px), 0); }
  65%  { opacity: 1; transform: translate3d(0, 6px, 0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes iosBannerOut{
  0%   { opacity: 1; transform: translate3d(0, 0, 0); }
  100% { opacity: 0; transform: translate3d(0, calc(-100% - 16px), 0); }
}

#toast.toast.visible{
  animation: iosBannerIn 520ms cubic-bezier(0.22, 1, 0.36, 1) both !important;
}

#toast.toast.hiding{
  pointer-events: none !important;
  animation: iosBannerOut 420ms cubic-bezier(0.4, 0, 0.2, 1) both !important;
}


/* =====================================================================
   Patch v68 (2026-01-14)
   Dolphin feedback:
   - In filter pills (Коллекция / Модель / Фон) when a single value is picked,
     make the preview (icon/dot + title) perfectly centered vertically.
   - Make the backdrop (Фон) color dot bigger and perfectly round.
   ===================================================================== */

:root{
  --filter-preview-size: 24px;
  --filter-preview-gap: 8px;
}

/* Single-value pills: keep inner row centered by height */
.filters-bar .filter-btn--single .filter-value{
  display: flex !important;
  align-items: center !important;
  min-height: var(--filter-preview-size) !important;
}

.filters-bar .filter-value-pill{
  display: inline-flex !important;
  align-items: center !important;
  gap: var(--filter-preview-gap) !important;
  height: var(--filter-preview-size) !important;
  min-height: var(--filter-preview-size) !important;
}

/* Prevent baseline drift from images inside flex rows */
.filters-bar .filter-value-icon img{
  display: block !important;
}

/* Normalize icon size so text centers correctly */
.filters-bar .filter-value-icon{
  width: var(--filter-preview-size) !important;
  height: var(--filter-preview-size) !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Text: make its box the same height as the icon so flex centering is perfect */
.filters-bar .filter-value-text{
  display: flex !important;
  align-items: center !important;
  height: var(--filter-preview-size) !important;
  line-height: var(--filter-preview-size) !important;
}

/* Backdrop dot: bigger + perfectly round (no oval artifacts) */
.filters-bar .filter-value-backdrop-dot{
  width: var(--filter-preview-size) !important;
  height: var(--filter-preview-size) !important;
  flex: 0 0 var(--filter-preview-size) !important;
  aspect-ratio: 1 / 1 !important;
  display: block !important;
  border-radius: 999px !important;
  box-sizing: border-box !important;
  border: 2px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22) inset;
}

/* Modal list icons: remove any inline image baseline spacing */
.item-icon img{
  display: block;
}


/* =====================================================================
   Patch v69 (2026-01-14)
   Dolphin QA:
   - Scroll-to-top button: smaller and proportional (must not stand out)
   - Hide scroll-to-top while any menu/sheet/overlay is open
   ===================================================================== */

.scroll-top-btn{
  width: 40px !important;
  height: 40px !important;
  right: 16px !important;
  bottom: calc(16px + 0px) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.26) !important;
}

.scroll-top-btn-icon{
  font-size: 16px !important;
}

/* Overlays are often transparent, so the button must be force-hidden */
html.overlay-open .scroll-top-btn,
html.overlay-open .scroll-top-btn.visible{
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}



/* =====================================================================
   Patch v70 (2026-01-14)
   Dolphin QA:
   - Top-up menu: keyboard should move the card smoothly (no instant "jerk")
   - Keep tap outside input to dismiss keyboard, but never close menu by mistake
   - Input: remove the white outline/border
   - Stars icon: use SVG (crisp on all DPIs)
   ===================================================================== */

/* 1) Top-up menu: stop shifting via padding (reflow = instant jump).
      Instead: translate the sheet by half of the keyboard inset (center in visible area).
      Uses stable viewport height so the overlay itself doesn't "shrink-jump". */
#topup-menu-overlay.tonkeeper-overlay{
  align-items: center !important;
  justify-content: center !important;

  /* Fixed "stable" height: do not depend on the animated visible viewport. */
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  height: var(--tg-viewport-stable-height, var(--tg-viewport-height, var(--app-height, 100vh))) !important;

  /* Remove keyboard inset padding (it causes the immediate jump via layout reflow). */
  padding-bottom: max(0px, 16px) !important;
}

/* Keep the compact sizing from earlier patches, but apply a smooth keyboard translate. */
#topup-menu-overlay .tonkeeper-sheet{
  transform: translate3d(0, calc(-0.5 * var(--tg-keyboard-inset, 0px)), 0) scale(0.94) !important;
  opacity: 0 !important;
  transition:
    transform var(--ui-menu-ms, 260ms) var(--ease-out, cubic-bezier(0.2, 0.9, 0.2, 1)),
    opacity  var(--ui-menu-ms, 260ms) var(--ease-out, cubic-bezier(0.2, 0.9, 0.2, 1)) !important;
  will-change: transform, opacity !important;
}

#topup-menu-overlay.visible .tonkeeper-sheet{
  transform: translate3d(0, calc(-0.5 * var(--tg-keyboard-inset, 0px)), 0) scale(1) !important;
  opacity: 1 !important;
}

#topup-menu-overlay.closing .tonkeeper-sheet{
  transform: translate3d(0, calc(-0.5 * var(--tg-keyboard-inset, 0px)), 0) scale(0.94) !important;
  opacity: 0 !important;
}

/* When "settled", keep the keyboard translate (do NOT reset to transform:none). */
#topup-menu-overlay.settled .tonkeeper-sheet{
  transform: translate3d(0, calc(-0.5 * var(--tg-keyboard-inset, 0px)), 0) scale(1) !important;
  opacity: 1 !important;
  will-change: transform !important;
}

/* 2) Input: remove white border/outline completely in the top-up menu. */
#topup-menu-sheet .tonkeeper-input{
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
#topup-menu-sheet .tonkeeper-input:focus{
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

/* 3) SVG star: make sure it stays crisp and properly aligned everywhere. */
.tg-star-icon{
  image-rendering: auto !important;
}


/* =====================================================================
   Patch v71 (2026-01-14)
   Dolphin QA:
   - Toast "balance topped up" must ALWAYS animate (no teleport).
     Split toast states: entering (keyframed) -> visible (stable).
   ===================================================================== */

/* Ensure .visible never runs the enter animation (so we can replay via .entering) */
#toast.toast.visible{
  animation: none !important;
}

/* Enter animation (separate class) */
#toast.toast.entering{
  visibility: visible !important;
  pointer-events: none !important;
  animation: iosBannerIn 520ms cubic-bezier(0.22, 1, 0.36, 1) both !important;
}


/* =====================================================================
   Patch v72 (2026-01-14)
   Dolphin QA:
   - iOS keyboard: top-up/payment menu must NOT "bounce" a second time.
     Let the WebView/Telegram handle viewport shift; do not apply our own
     keyboard translate based on --tg-keyboard-inset.
   ===================================================================== */

/* Use the *visible* viewport height (shrinks with keyboard) like other sheets. */
#topup-menu-overlay.tonkeeper-overlay{
  align-items: flex-end !important;
  justify-content: center !important;
  height: var(--tg-viewport-height, var(--app-height, 100vh)) !important;
  bottom: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  padding-bottom: 0px !important;
}

/* Remove keyboard-driven translate/scale so the sheet doesn't move twice. */
#topup-menu-overlay .tonkeeper-sheet{
  transform: translate3d(0, 110%, 0) !important;
  opacity: 1 !important;
  transition: transform var(--ui-menu-ms, 360ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  will-change: transform !important;
}
#topup-menu-overlay.visible .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) !important;
}
#topup-menu-overlay.closing .tonkeeper-sheet{
  transform: translate3d(0, 110%, 0) !important;
}
/* When "settled", drop transforms for crisp text (keep consistent with global rules). */
#topup-menu-overlay.settled .tonkeeper-sheet{
  transform: none !important;
  will-change: auto !important;
}



/* =====================================================================
   Patch v73 (2026-01-14)
   Dolphin QA:
   - Remove X (clear) in # number input completely
   - Remove hover/active highlight animation on ALL close (X) buttons incl. payments
   - Fix advanced (#) panel slide-out race + desktop micro-jitter
   ===================================================================== */

/* 1) Advanced # input: no clear X at all */
#advanced-search-clear{
  display: none !important;
}
/* Input no longer needs extra right padding for the clear button */
#advanced-panel .advanced-search .search-input{
  padding-right: 16px !important;
}

/* 2) Close buttons: remove hover/active highlight + micro animations everywhere */
.modal-close-btn,
.gift-sheet-close,
.result-sheet-close,
.tonkeeper-close{
  transition: none !important;
  transform: none !important;
  background: transparent !important;
}
.modal-close-btn:hover,
.gift-sheet-close:hover,
.result-sheet-close:hover,
.tonkeeper-close:hover{
  background: transparent !important;
  transform: none !important;
}



/* =====================================================================
   Patch v74 (2026-01-14)
   Dolphin request:
   - Filters bottom-sheets (collections/models/backdrops) MUST close with
     the exact same slide-down animation as the gift menu close.
   Notes:
   - Gift sheet uses `.gift-sheet-overlay.closing .gift-sheet { transform: translateY(100%) }`
     which starts the slide immediately when `.closing` is added.
   - These filter modals previously waited for `.open` to be removed (extra frame)
     and also used a custom ::before backdrop. We override both ONLY for these
     three filter modals.
   ===================================================================== */

/* Use the same backdrop approach as the gift sheet (no modal ::before hack) */
#collections-modal,
#models-modal,
#backdrops-modal{
  background: var(--menu-backdrop-bg, rgba(0, 0, 0, 0.78)) !important;
}

#collections-modal::before,
#models-modal::before,
#backdrops-modal::before{
  content: none !important;
  display: none !important;
}

/* Match gift menu motion: start sliding DOWN immediately on `.closing` */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  transform: translateY(100%) !important;
  transition: transform var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  will-change: transform;
}

#collections-modal.open .modal,
#models-modal.open .modal,
#backdrops-modal.open .modal{
  transform: translateY(0) !important;
}

/* IMPORTANT: keep this block after the `.open` rules so it wins when both
   `.open` and `.closing` are present (same behavior as gift menu close). */
#collections-modal.closing .modal,
#models-modal.closing .modal,
#backdrops-modal.closing .modal{
  transform: translateY(100%) !important;
}

/* =====================================================================
   Patch v80 (2026-01-14)
   Fix: Filters (collections/models/backdrops) MUST close 1:1 like the
   CURRENT gift sheet close animation.

   Notes:
   - Gift sheet uses: transform 250ms cubic-bezier(0.32, 0.72, 0, 1)
   - Restore modal-overlay ::before backdrop for filters (v79 disabled it)
   ===================================================================== */

/* Restore backdrop pseudo-element for filter overlays */
#collections-modal,
#models-modal,
#backdrops-modal{
  background: transparent !important;
}

#collections-modal::before,
#models-modal::before,
#backdrops-modal::before{
  content: "" !important;
  display: block !important;
}

/* Exact gift-sheet slide timing + easing */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  transform: translateY(100%) !important;
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1) !important;
  will-change: transform;
}

#collections-modal.open .modal,
#models-modal.open .modal,
#backdrops-modal.open .modal{
  transform: translateY(0) !important;
}

#collections-modal.closing .modal,
#models-modal.closing .modal,
#backdrops-modal.closing .modal{
  transform: translateY(100%) !important;
}

/* Safety: if some build adds `.settled` for filters, keep it stable */
#collections-modal.settled .modal,
#models-modal.settled .modal,
#backdrops-modal.settled .modal{
  will-change: auto !important;
}
.modal-close-btn:active,
.gift-sheet-close:active,
.result-sheet-close:active,
.tonkeeper-close:active{
  background: transparent !important;
  transform: none !important;
}

/* 3) Advanced panel: ONLY height animation, no max-height/opacity/translate -> no end bump */
#advanced-panel.advanced-panel{
  max-height: none !important;
  opacity: 1 !important;
  transform: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  transition: height var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  will-change: height !important;
}

/* Keep the extra bottom breathing room INSIDE the animated height (no margin jumps) */
#advanced-panel.advanced-panel::after{
  content: "";
  display: block;
  height: 0;
}
#advanced-panel.advanced-panel.open::after,
#advanced-panel.advanced-panel.closing::after{
  height: 12px;
}

/* Inner row must not animate/shift on its own (that caused 1-2px jitter on desktop) */
#advanced-panel .advanced-search{
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
  will-change: auto !important;
}

/* Arrow button: no press-scale (can desync with panel during rapid taps) */
#advanced-trigger:active{
  transform: none !important;
}

/* =====================================================================
   Patch v74 (2026-01-14)
   Dolphin:
   - Fix: верхняя стрелка на кнопке (двойной шеврон) была ярче, потому что
     :disabled применялся только к нижней части (исправлено выше).
   - Fix: при открытии любого меню (подарок/фильтры/оплата) не должно
     «пропадать» закреплённое поле с кнопками + поиском. Делиммер/бекдроп
     теперь начинается НИЖЕ sticky-блока, когда он уже закреплён сверху.
   ===================================================================== */

:root{ --overlay-top-offset: 0px; }

/* Always keep overlay containers transparent; backdrop is handled separately. */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay,
#payment-success-overlay,
#payment-fail-overlay,
#purchase-cancel-overlay,
#price-change-overlay,
.maintenance-overlay{
  background: transparent !important;
}

/* Backdrop layer should not cover the pinned sticky header area. */
.modal-overlay::before,
.gift-sheet-overlay::before,
.pay-sheet-overlay::before,
.tonkeeper-overlay::before,
#payment-success-overlay::before,
#payment-fail-overlay::before,
#purchase-cancel-overlay::before,
#price-change-overlay::before,
.maintenance-overlay::before{
  top: var(--overlay-top-offset, 0px) !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* =====================================================================
   Patch v75 (2026-01-14)
   Dolphin fixes:
   1) When opening any menu/overlay, keep the sticky controls ("buttons island")
      visible and NOT blurred/dimmed.
   2) Payment menu + "Завершите оплату" menu must be strictly centered.
   3) Advanced search panel (#номер): smoother + stable when spamming, and less jank on Windows.
   ===================================================================== */

/* 1) Overlays: NEVER blur/dim the sticky controls area.
   Backdrop is rendered via ::before starting at --overlay-top-offset. */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay,
#payment-success-overlay,
#payment-fail-overlay,
#purchase-cancel-overlay,
#price-change-overlay,
.maintenance-overlay{
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Force the backdrop pseudo-element to respect the top offset (and override older `inset:` shorthands). */
.modal-overlay::before,
.gift-sheet-overlay::before,
.pay-sheet-overlay::before,
.tonkeeper-overlay::before,
#payment-success-overlay::before,
#payment-fail-overlay::before,
#purchase-cancel-overlay::before,
#price-change-overlay::before,
.maintenance-overlay::before{
  inset: auto !important;
  top: var(--overlay-top-offset, 0px) !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* 2) Center payment overlays (top-up + tonkeeper confirm). */
#topup-menu-overlay.tonkeeper-overlay,
#payment-confirm-overlay.tonkeeper-overlay{
  align-items: center !important;
  justify-content: center !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  padding-top: max(16px, 0px) !important;
  padding-bottom: max(16px, 0px) !important;
}

/* Pop-in animation that stays centered (no bottom-sheet slide). */
#topup-menu-overlay .tonkeeper-sheet,
#payment-confirm-overlay .tonkeeper-sheet{
  transform: translate3d(0, 12px, 0) scale(0.96) !important;
  opacity: 0 !important;
  transition:
    transform var(--ui-menu-ms, 360ms) cubic-bezier(0.22, 1, 0.36, 1),
    opacity   var(--ui-menu-ms, 360ms) cubic-bezier(0.22, 1, 0.36, 1) !important;
}

#topup-menu-overlay.visible .tonkeeper-sheet,
#payment-confirm-overlay.visible .tonkeeper-sheet{
  transform: translate3d(0, 0, 0) scale(1) !important;
  opacity: 1 !important;
}

#topup-menu-overlay.settled .tonkeeper-sheet,
#payment-confirm-overlay.settled .tonkeeper-sheet{
  transform: none !important;
}

#topup-menu-overlay.closing .tonkeeper-sheet,
#payment-confirm-overlay.closing .tonkeeper-sheet{
  transform: translate3d(0, 12px, 0) scale(0.96) !important;
  opacity: 0 !important;
}

/* 3) Advanced search panel: isolate layout changes to reduce jank.
   Keep height animation, but make it short and stable. */
#advanced-panel.advanced-panel{
  contain: layout paint;
  will-change: height;
  transition: height 220ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* Remove pseudo breathing-room hacks that can change scrollHeight mid-transition. */
#advanced-panel.advanced-panel::after{
  content: none !important;
}

/* =====================================================================
   Patch v77 (2026-01-14)
   Dolphin:
   - Fix buggy advanced # panel: no clipping, consistent bottom breathing room
   - Payment menus background: match reference (#282727)
   - Overlays must dim the WHOLE screen (banner + balance + sticky controls)
   ===================================================================== */

/* 1) Advanced panel: always include a small fixed bottom spacer so height measurements are stable */
#advanced-panel.advanced-panel::after{
  content: "" !important;
  display: block !important;
  height: 12px !important;
}

/* =====================================================================
   Patch v78 (2026-01-14)
   Dolphin QA:
   - Desktop: advanced # panel should NOT visually "grow" at the very end.
     The extra bottom spacer is useful on mobile WebViews, but on PC it reads
     like a last-moment size bump.
   ===================================================================== */

html.tg-desktop #advanced-panel.advanced-panel::after{
  height: 12px !important;
}

/* 2) Payment sheets background */
.pay-sheet,
.result-sheet,
.tonkeeper-sheet,
#balance-modal .modal{
  background: #282727 !important;
}

/* 3) Overlays: always cover the entire viewport */
:root{
  --overlay-top-offset: 0px !important;
}
.gift-sheet-overlay::before,
.modal-overlay::before,
.pay-sheet-overlay::before,
.tonkeeper-overlay::before,
#payment-success-overlay::before,
#payment-fail-overlay::before,
#purchase-cancel-overlay::before,
#price-change-overlay::before,
.maintenance-overlay::before{
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* =====================================================================
   Patch v79 (2026-01-14)
   Dolphin request:
   - Filters modals (collections/models/backdrops): close animation must be
     1:1 with the CURRENT gift sheet close (slide down immediately on .closing)
   ===================================================================== */

/* Gift sheet uses the overlay background (no ::before hacks). Do the same for filter modals. */
#collections-modal,
#models-modal,
#backdrops-modal{
  background: var(--menu-backdrop-bg, rgba(0, 0, 0, 0.78)) !important;
}
#collections-modal::before,
#models-modal::before,
#backdrops-modal::before{
  content: none !important;
  display: none !important;
}

/* Slide rules: match gift sheet (translateY + same duration/ease). */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  transform: translateY(100%) !important;
  transition: transform var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
  will-change: transform;
}
#collections-modal.open .modal,
#models-modal.open .modal,
#backdrops-modal.open .modal{
  transform: translateY(0) !important;
}
/* IMPORTANT: override .open even while it is still present (closeModal removes .open next frame). */
#collections-modal.closing .modal,
#models-modal.closing .modal,
#backdrops-modal.closing .modal{
  transform: translateY(100%) !important;
}

/* =====================================================================
   Patch v80 (2026-01-14)
   Fix: Filter menus (collections/models/backdrops) close animation must be
   EXACTLY the same as the current gift sheet close animation.

   Notes:
   - Gift sheet uses: transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1)
   - Gift sheet slides to: translateY(100%)
   - We also restore the shared backdrop pseudo-element for these modals
     (v79 accidentally disabled it).
   ===================================================================== */

/* Restore shared backdrop implementation for filter modals */
#collections-modal,
#models-modal,
#backdrops-modal{
  background: transparent !important;
}
#collections-modal.modal-overlay::before,
#models-modal.modal-overlay::before,
#backdrops-modal.modal-overlay::before{
  content: "" !important;
  display: block !important;
}

/* Match the gift sheet slide timing & easing 1:1 */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  transform: translateY(100%) !important;
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1) !important;
  will-change: transform;
}
#collections-modal.open .modal,
#models-modal.open .modal,
#backdrops-modal.open .modal{
  transform: translateY(0) !important;
}
#collections-modal.closing .modal,
#models-modal.closing .modal,
#backdrops-modal.closing .modal{
  transform: translateY(100%) !important;
}

/* Safety: if a rare build sets `.settled` on these modals, keep them stable */
#collections-modal.settled .modal,
#models-modal.settled .modal,
#backdrops-modal.settled .modal{
  transform: translateY(0) !important;
  will-change: auto !important;
}

/* === PATCH: Stars-first top-up + payment menu tweaks (2026-01-14) === */
/* Quick top-up segmented control: Stars is the FIRST button now (pixel-perfect slide). */
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode::before {
  transform: translate3d(0, 0, 0) !important;
}
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode[data-mode="RUB"]::before {
  transform: translate3d(100%, 0, 0) !important;
}
#topup-menu-sheet #quick-topup-paymode.quick-topup-paymode[data-mode="STARS"]::before {
  transform: translate3d(0, 0, 0) !important;
}

/* Disable close button "highlight" animation/transition in payment menus. */
#topup-menu-sheet .tonkeeper-close,
#payment-confirm-sheet .tonkeeper-close {
  transition: none !important;
}
#topup-menu-sheet .tonkeeper-close:hover,
#topup-menu-sheet .tonkeeper-close:active,
#topup-menu-sheet .tonkeeper-close:focus,
#topup-menu-sheet .tonkeeper-close:focus-visible,
#payment-confirm-sheet .tonkeeper-close:hover,
#payment-confirm-sheet .tonkeeper-close:active,
#payment-confirm-sheet .tonkeeper-close:focus,
#payment-confirm-sheet .tonkeeper-close:focus-visible {
  background: transparent !important;
  box-shadow: none !important;
}

/* Balance modal close (also a payment menu) */
#balance-modal .modal-close-btn{
  transition: none !important;
}
#balance-modal .modal-close-btn:hover,
#balance-modal .modal-close-btn:active,
#balance-modal .modal-close-btn:focus,
#balance-modal .modal-close-btn:focus-visible{
  background: transparent !important;
  box-shadow: none !important;
}

/* =====================================================================
   Patch v79 (2026-01-15)
   Dolphin QA:
   - Toast (web notification): smooth slide from TOP, stay visible ~4s, slide back up
   - "Завершите оплату" (payment confirm): close should be animated (no abrupt hide)
   ===================================================================== */

:root{
  --toast-slide-ms: 220ms;
}

/* Toast: always a top banner that slides in/out (no fade). */
.toast{
  transition: transform var(--toast-slide-ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
  transform: translate3d(0, -140%, 0) !important;
  visibility: hidden !important;
  opacity: 1 !important;
  will-change: transform !important;
}
.toast.visible,
.toast.entering{
  visibility: visible !important;
  transform: translate3d(0, 0, 0) !important;
}
.toast.hiding{
  visibility: visible !important;
  transform: translate3d(0, -140%, 0) !important;
}

/* Payment confirm sheet: re-enable slide transitions (Patch v48 disabled them). */
#payment-confirm-overlay .tonkeeper-sheet--confirm{
  transform: translate3d(0, 110%, 0) !important;
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1) !important;
  will-change: transform !important;
}
#payment-confirm-overlay.visible .tonkeeper-sheet--confirm{
  transform: translate3d(0, 0, 0) !important;
}
#payment-confirm-overlay.closing .tonkeeper-sheet--confirm{
  transform: translate3d(0, 110%, 0) !important;
}

/* =====================================================================
   Patch v90 (2026-01-15)
   Dolphin:
   - Advanced # input panel: smooth + consistent (no jank)
   - Filters modals: EXACTLY the same slide animation as the gift sheet
   - Balance top-up toast: MUST slide in/out (some older rules disabled transitions on #toast)
   ===================================================================== */

/* 1) Toast: force-enable transitions specifically on #toast (it had a stronger selector earlier). */
:root{ --toast-slide-ms: 280ms; }

#toast.toast{
  transition: transform var(--toast-slide-ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
  transform: translate3d(0, -140%, 0) !important;
  visibility: hidden !important;
  opacity: 1 !important;
  will-change: transform !important;
}
#toast.toast.visible,
#toast.toast.entering{
  visibility: visible !important;
  transform: translate3d(0, 0, 0) !important;
}
#toast.toast.hiding{
  visibility: visible !important;
  transform: translate3d(0, -140%, 0) !important;
}

/* 2) Advanced # panel: match the global menu timing/easing (JS uses --ui-menu-ms). */
#advanced-panel.advanced-panel{
  contain: layout paint;
  overflow: hidden !important;
  will-change: height;
  transition: height var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}
#advanced-panel.advanced-panel .advanced-search{
  transform: translate3d(0, -6px, 0);
  opacity: 0;
  will-change: transform, opacity;
  transition:
    transform var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity   var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}

#advanced-panel.advanced-panel.open .advanced-search{
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

#advanced-panel.advanced-panel.closing .advanced-search{
  transform: translate3d(0, -6px, 0);
  opacity: 0;
}

/* 3) Filters modals: use the SAME timing/easing as the gift sheet (via --ui-menu-ms/--ease-out). */
#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  transform: translate3d(0, 100%, 0) !important;
  transition: transform var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
  will-change: transform !important;
}
#collections-modal.open .modal,
#models-modal.open .modal,
#backdrops-modal.open .modal{
  transform: translate3d(0, 0, 0) !important;
}
#collections-modal.closing .modal,
#models-modal.closing .modal,
#backdrops-modal.closing .modal{
  transform: translate3d(0, 100%, 0) !important;
}

/* Also make sure the gift sheet uses the exact same transition (some earlier patches differed). */
.gift-sheet-overlay .gift-sheet{
  transition: transform var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
  will-change: transform !important;
}

/* =====================================================================
   Patch v93 (2026-01-15)
   Dolphin request:
   - Replace ALL blue (accent) button backgrounds with the provided green texture
   - Also apply to the ₽ circle in the balance pill
   - Remove the "turn green on success" visual change (button stays the same)
   ===================================================================== */

:root{
  /* Keep accent semantics, but switch the accent color to a matching green */
  --tg-accent: #2AAE5D;
  --tg-accent-soft: rgba(42, 174, 93, 0.16);
}

/* Green textured fill (WEBP first, PNG fallback). */
:root{
  --gp-accent-bg: url("../img/accent-green.webp"), url("../img/accent-green.png");
}

/* Helper: apply textured accent background */
.gp-accent-bg,
.modal-btn.primary,
.gift-sheet-buy-bar,
.buy-btn,
.gift-buy-btn,
.result-btn--primary,
.pay-action--primary,
.balance-pill-icon,
.balance-plus,
.balance-plus-btn,
.tonkeeper-btn,
.scroll-top-btn.visible{
  background-color: var(--tg-accent) !important;
  background-image: var(--gp-accent-bg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  color: #ffffff !important;
}

/* Keep hover/active the same (no blue hover / no "success turns green" change). */
.modal-btn.primary:hover,
.modal-btn.primary:active,
.gift-sheet-buy-bar:hover,
.gift-sheet-buy-bar:active,
.buy-btn:hover,
.buy-btn:active,
.gift-buy-btn:hover,
.gift-buy-btn:active,
.result-btn--primary:hover,
.result-btn--primary:active,
.pay-action--primary:hover,
.pay-action--primary:active,
.balance-plus:hover,
.balance-plus:active,
.balance-plus-btn:hover,
.balance-plus-btn:active,
.tonkeeper-btn:hover,
.tonkeeper-btn:active,
.tonkeeper-btn:disabled,
.scroll-top-btn.visible:hover,
.scroll-top-btn.visible:active{
  background-color: var(--tg-accent) !important;
  background-image: var(--gp-accent-bg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* Purchased/locked states: keep the SAME background as default (only text/disabled state differs). */
.gift-card--bought .gift-buy-btn,
.gift-card--bought .gift-buy-btn:hover,
.gift-card--bought .gift-buy-btn:active,
.gift-card--bought .gift-buy-btn:disabled,
.gift-card--locked .gift-buy-btn,
.gift-card--locked .gift-buy-btn:hover,
.gift-card--locked .gift-buy-btn:active,
.gift-card--locked .gift-buy-btn:disabled{
  background-color: var(--tg-accent) !important;
  background-image: var(--gp-accent-bg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  color: #ffffff !important;
}

/* Gift sheet buy bar "success" states: do NOT change background anymore. */
.gift-sheet-buy-bar[data-state="paid_wait"],
.gift-sheet-buy-bar[data-state="delivering"],
.gift-sheet-buy-bar[data-state="bought"],
.gift-sheet-buy-bar[data-state="paid_wait"]:hover,
.gift-sheet-buy-bar[data-state="delivering"]:hover,
.gift-sheet-buy-bar[data-state="bought"]:hover{
  background-color: var(--tg-accent) !important;
  background-image: var(--gp-accent-bg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* The tiny "advanced" dot should match the new accent color. */
#advanced-trigger.has-advanced::after{
  background: var(--tg-accent) !important;
}



/* =====================================================================
   Patch v96 (2026-01-15)
   Dolphin:
   - Close buttons: guarantee clickability (bigger hitbox + z-index)
   - Green CTA: single tone everywhere (no gradients)
   ===================================================================== */
.modal-close-btn,
.gift-sheet-close,
.result-sheet-close,
.tonkeeper-close{
  pointer-events: auto !important;
  z-index: 50 !important;
}

.tonkeeper-close{
  width: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  font-size: 28px !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Success CTA button: no green gradients, same as --tg-green */
.result-btn--success{
  background: var(--tg-green) !important;
  color: #fff !important;
}


/* =====================================================================
   Patch v97 (2026-01-15)
   Dolphin QA:
   - Desktop: prevent 1px layout shift when the advanced input panel opens/closes
   - Keep scrollbar gutter stable
   ===================================================================== */
html.tg-desktop main{
  overflow-y: scroll !important;
  scrollbar-gutter: stable;
}

/* =====================================================================
   Patch v99 (2026-01-15)
   Bug fixes (improved):
   1) Balance pill icon (₽) and plus button: COMPLETE texture removal
      - Added !important to ALL properties to override any texture
      - Added image-rendering: auto to ensure crisp rendering
      - Removed any box-shadow, filter, backdrop-filter
   2) Banner: Stronger muting to match button colors better
   3) Advanced panel animation: FIXED desktop jank/bump completely
      - Use contain: strict for better isolation
      - Force integer pixel values
      - Prevent ANY height recalculation at animation end
   4) Filter modals: EXACT same animation as gift sheet (copied 1:1)
   5) Sticky filters: NEVER hide when modals open (proper z-index fix)
   ===================================================================== */

/* 1) FIX: Balance icons - SOLID color, NO texture, NO artifacts */
/* Force solid color rendering without any gradient/texture/filter artifacts */
.balance-pill,
.balance-pill-inner{
  background-image: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.balance-pill-icon{
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  border: none !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 22px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  /* CRITICAL: Pure solid color - no gradients, no textures */
  background: #248bfe !important;
  background-color: #248bfe !important;
  background-image: none !important;
  background-blend-mode: normal !important;
  color: #ffffff !important;
  text-shadow: none !important;
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  image-rendering: auto !important;
  /* Force GPU layer for crisp rendering */
  transform: translateZ(0) !important;
  will-change: auto !important;
}

.balance-plus-btn{
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  border: none !important;
  outline: none !important;
  /* CRITICAL: Pure solid color */
  background: #2AAE5D !important;
  background-color: #2AAE5D !important;
  background-image: none !important;
  background-blend-mode: normal !important;
  color: #ffffff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transform: translateZ(0) !important;
  will-change: auto !important;
}

.balance-plus-btn svg{
  width: 12px !important;
  height: 12px !important;
  display: block !important;
  fill: currentColor !important;
}

.balance-plus-btn:hover,
.balance-plus-btn:active,
.balance-plus-btn:focus{
  background: #2AAE5D !important;
  background-color: #2AAE5D !important;
  background-image: none !important;
  outline: none !important;
  box-shadow: none !important;
  filter: none !important;
}

/* 2) FIX: Banner - stronger muting to match button colors */
/* Much darker overlay for proper color matching */
.top-promo-banner--photo{
  position: relative !important;
}

.top-promo-banner--photo::before{
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.40) 50%,
    rgba(0, 0, 0, 0.50) 100%
  ) !important;
  z-index: 1 !important;
  pointer-events: none !important;
  border-radius: inherit !important;
}

/* Stronger desaturation and dimming of the banner image */
.top-promo-banner-photo,
.top-promo-banner-photo.is-loaded{
  filter: saturate(0.6) brightness(0.68) contrast(1.05) !important;
}

/* 3) FIX: Advanced panel animation - COMPLETE fix for desktop jank */
/* The problem: scrollHeight can change by 1-2px between measurements */
/* Solution: Use contain:strict, never remeasure, use integer pixels */
#advanced-panel.advanced-panel{
  contain: strict !important;
  overflow: hidden !important;
  will-change: height !important;
  transition: height var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
  /* Force GPU compositing to prevent subpixel issues */
  transform: translateZ(0) !important;
  backface-visibility: hidden !important;
  /* Prevent content from affecting container size during animation */
  box-sizing: border-box !important;
}

/* Inner content fades in/out smoothly */
#advanced-panel.advanced-panel .advanced-search{
  transform: translate3d(0, -8px, 0);
  opacity: 0;
  will-change: transform, opacity;
  transition:
    transform var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity var(--ui-menu-ms, 520ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}

#advanced-panel.advanced-panel.open .advanced-search{
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

#advanced-panel.advanced-panel.closing .advanced-search{
  transform: translate3d(0, -8px, 0);
  opacity: 0;
}

/* Desktop specific: extra stabilization for scroll compensation */
html.tg-desktop #advanced-panel.advanced-panel{
  box-sizing: border-box !important;
  /* Prevent ANY layout recalculation from affecting parent */
  contain: strict !important;
}

/* Prevent scrollbar appearance changes from causing layout shift */
html.tg-desktop main{
  overflow-y: scroll !important;
  scrollbar-gutter: stable !important;
}

/* 4) FIX: Filter modals - EXACT same animation as gift sheet */
/* All modal overlays use the EXACT same timing and easing */
:root{
  --modal-slide-ms: 520ms;
  --modal-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Collections, Models, Backdrops modals - copied 1:1 from gift-sheet */
#collections-modal,
#models-modal,
#backdrops-modal{
  transition: opacity var(--modal-slide-ms) var(--modal-ease) !important;
}

#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  transform: translate3d(0, 100%, 0) !important;
  transition: transform var(--modal-slide-ms) var(--modal-ease) !important;
  will-change: transform !important;
}

#collections-modal.open .modal,
#models-modal.open .modal,
#backdrops-modal.open .modal{
  transform: translate3d(0, 0, 0) !important;
}

/* CRITICAL: Closing animation MUST be IDENTICAL to gift sheet */
#collections-modal.closing .modal,
#models-modal.closing .modal,
#backdrops-modal.closing .modal{
  transform: translate3d(0, 100%, 0) !important;
  transition: transform var(--modal-slide-ms) var(--modal-ease) !important;
}

/* Gift sheet uses the EXACT same timing - for reference */
.gift-sheet-overlay .gift-sheet,
#gift-sheet-overlay .gift-sheet{
  transition: transform var(--modal-slide-ms) var(--modal-ease) !important;
  will-change: transform !important;
}

.gift-sheet-overlay.visible .gift-sheet,
#gift-sheet-overlay.visible .gift-sheet{
  transform: translate3d(0, 0, 0) !important;
}

.gift-sheet-overlay.closing .gift-sheet,
#gift-sheet-overlay.closing .gift-sheet{
  transform: translate3d(0, 100%, 0) !important;
  transition: transform var(--modal-slide-ms) var(--modal-ease) !important;
}

/* 5) FIX: Sticky filters - NEVER hide when ANY modal is open */
/* The bug: sticky-filters was getting hidden due to overflow:hidden on parent */
/* Solution: Force visibility and use proper z-index stacking */
#sticky-filters,
.sticky-filters{
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  /* Ensure it's above main content but below modal backdrop */
  z-index: 60 !important;
}

/* When ANY overlay is open, sticky-filters stays visible */
/* It will be visually behind the modal backdrop (z-index 100+) */
body.overlay-open #sticky-filters,
body.overlay-open .sticky-filters,
html.overlay-open #sticky-filters,
html.overlay-open .sticky-filters{
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure overlays don't use display:none or visibility:hidden on siblings */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay{
  /* Modal overlays should NOT affect sibling visibility */
  isolation: isolate !important;
}

/* Main container should NEVER hide overflow when overlay is open */
/* This was causing sticky-filters to disappear */
body.overlay-open main,
html.overlay-open main{
  overflow: visible !important;
}

/* But the body itself can restrict overflow to prevent background scroll */
body.overlay-open{
  overflow: hidden !important;
}

/* Ensure main scroller keeps its scroll position */
main{
  /* Don't clip sticky children when overlays open */
  overflow-x: hidden !important;
  overflow-y: auto !important;
}


/* =====================================================================
   Patch v100 (2026-01-15)
   Dolphin QA:
   1) Balance (+) and ₽ icons: remove artifacts, make BOTH green.
   2) Banner: slightly brighter to better match button colors.
   3) Advanced panel (#номер): eliminate desktop "final bump" + keep margins stable.
   4) Filter modals: close animation 1:1 with gift sheet (use --ui-menu-ms).
   5) Sticky filters: never disappear when overlays open; keep scroll container stable.
   ===================================================================== */

/* 1) Balance icons: solid green, no textures/filters, crisp rendering */
.balance-pill-icon{
  background: #2AAE5D !important;
  background-color: #2AAE5D !important;
  background-image: none !important;
  background-blend-mode: normal !important;
  color: #ffffff !important;
  box-shadow: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.balance-plus-btn{
  background: #2AAE5D !important;
  background-color: #2AAE5D !important;
  background-image: none !important;
  background-blend-mode: normal !important;
  color: #ffffff !important;
  box-shadow: none !important;
  filter: none !important;
  transform: translateZ(0) !important;
}

/* We switched to a stroke-based plus to avoid aliasing speckles */
.balance-plus-btn svg{
  fill: none !important;
  stroke: currentColor !important;
  shape-rendering: geometricPrecision !important;
}
.balance-plus-btn svg path{
  stroke: currentColor !important;
}

/* 2) Banner: brighten a bit (the previous patch dimmed it too much) */
.top-promo-banner--photo::before{
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.22) 0%,
    rgba(0, 0, 0, 0.28) 55%,
    rgba(0, 0, 0, 0.36) 100%
  ) !important;
}

.top-promo-banner-photo,
.top-promo-banner-photo.is-loaded{
  filter: saturate(0.78) brightness(0.80) contrast(1.04) !important;
}

/* 3) Advanced panel: prevent any max-height/pseudo-element/margin tricks from causing bumps */
#advanced-panel.advanced-panel{
  max-height: none !important;
  padding: 0 !important;
  transition: height var(--ui-menu-ms, 260ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}

/* Kill legacy breathing-room pseudo-elements so height is purely JS-driven */
#advanced-panel.advanced-panel::after{
  content: none !important;
  display: none !important;
  height: 0 !important;
}

/* Keep spacing stable regardless of focus */
#sticky-filters #advanced-panel.advanced-panel{ margin-bottom: 0 !important; }
#sticky-filters #advanced-panel.advanced-panel.open,
#sticky-filters #advanced-panel.advanced-panel.open:focus-within,
#sticky-filters #advanced-panel.advanced-panel.closing{
  margin-bottom: var(--sticky-stack-gap, 10px) !important;
}

/* 4) Filter modals: use the same duration/easing as gift sheet + JS timers (no 520ms mismatch) */
#collections-modal,
#models-modal,
#backdrops-modal{
  transition: opacity var(--ui-menu-ms, 260ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}

#collections-modal .modal,
#models-modal .modal,
#backdrops-modal .modal{
  transition: transform var(--ui-menu-ms, 260ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}

.gift-sheet-overlay .gift-sheet,
#gift-sheet-overlay .gift-sheet{
  transition: transform var(--ui-menu-ms, 260ms) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}

/* 5) Sticky filters: never disappear when overlays open (keep main scroll container stable) */
html.overlay-open main,
body.overlay-open main{
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Prevent browser scroll anchoring from nudging the view when overlays mount/unmount */
main,
body,
html{
  overflow-anchor: none !important;
}


/* =====================================================================
   Patch v101 (2026-01-15)
   Dolphin:
   - Filter menus (collections/models/backdrops): remove the "translucent sheet"
     effect while closing (never animate parent overlay opacity).
   - Advanced # panel: no margin-driven layout jumps; animate ONLY height.
   ===================================================================== */

/* 1) Filter list modals: keep the sheet fully opaque at all times. */
#collections-modal.modal-overlay,
#models-modal.modal-overlay,
#backdrops-modal.modal-overlay{
  opacity: 1 !important;
  transition: none !important;
}
#collections-modal.modal-overlay.open,
#models-modal.modal-overlay.open,
#backdrops-modal.modal-overlay.open,
#collections-modal.modal-overlay.closing,
#models-modal.modal-overlay.closing,
#backdrops-modal.modal-overlay.closing{
  opacity: 1 !important;
}

/* Dim layer: fade only the backdrop pseudo-element (NOT the whole overlay). */
#collections-modal.modal-overlay::before,
#models-modal.modal-overlay::before,
#backdrops-modal.modal-overlay::before{
  opacity: 0 !important;
  transition: opacity var(--ui-menu-ms, 280ms) var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) !important;
}
#collections-modal.modal-overlay.open::before,
#models-modal.modal-overlay.open::before,
#backdrops-modal.modal-overlay.open::before{
  opacity: 1 !important;
}
#collections-modal.modal-overlay.closing::before,
#models-modal.modal-overlay.closing::before,
#backdrops-modal.modal-overlay.closing::before{
  opacity: 0 !important;
  transition: none !important;
}

/* 2) Advanced panel: spacing must be inside the animated height, not via margins. */
#sticky-filters #advanced-panel.advanced-panel,
#sticky-filters #advanced-panel.advanced-panel.open,
#sticky-filters #advanced-panel.advanced-panel.closing,
#sticky-filters #advanced-panel.advanced-panel.open:focus-within{
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}


/* =====================================================================
   Patch v102 (2026-01-15)
   Dolphin:
   - Advanced panel (#номер): stop clipping/"cut" borders while sliding out
     and remove janky inner transforms.
   - Keep a fast, smooth expansion (independent from global --ui-menu-ms).
   Note: extra bottom spacing is handled by JS via a small height buffer.
   ===================================================================== */

/* Make the advanced panel feel snappy (do not inherit the long 520ms menu timing). */
#advanced-panel.advanced-panel{
  transition: height 280ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* Ensure we really animate ONLY height (no translateY nudges). */
#advanced-panel.advanced-panel,
#advanced-panel.advanced-panel.open,
#advanced-panel.advanced-panel.closing{
  transform: none !important;
}

/* Inner row: no translate/opacity choreography (caused clipping + "laggy" feel). */
#advanced-panel.advanced-panel .advanced-search{
  transform: none !important;
  opacity: 1 !important;
  transition: none !important;
  will-change: auto !important;
}

/* =====================================================================
   Patch v103 (2026-01-15)
   Dolphin:
   - Sticky filters: stop bottom "cut" when pinned (avoid margin-collapsing)
   - Advanced panel (#номер): remove the last 1px "ghost" line during close
   ===================================================================== */

/* 1) Sticky filters: the bottom gap must be part of the sticky box.
      Using only child margins can collapse and visually removes spacing when pinned. */
#sticky-filters,
.sticky-filters{
  padding-bottom: var(--sticky-stack-gap, 10px) !important;
  box-sizing: border-box !important;
}

/* Keep a predictable gap under the top row even when other items are hidden. */
#sticky-filters .filters-bar{
  margin-bottom: var(--sticky-stack-gap, 10px) !important;
}

/* 2) Advanced search chrome: fade out quickly on CLOSE so the wrapper border
      cannot linger as a thin line when the panel height reaches the last pixels. */
#advanced-panel.advanced-panel .advanced-search{
  transition: background-color 120ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
              border-color     120ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}
#advanced-panel.advanced-panel.closing .advanced-search{
  background-color: transparent !important;
  border-color: transparent !important;
}


/* =====================================================================
   Patch v104 (2026-01-15)
   Dolphin:
   - Normalize ALL vertical spacing inside the sticky "island" so it looks identical
     across states (no double margins when reset/search is shown).
   - Keep spacing stable without margin-collapsing glitches by using flex + gap.
   ===================================================================== */

#sticky-filters,
.sticky-filters{
  /* Stack rows with a single source of truth for spacing */
  display: flex !important;
  flex-direction: column !important;
  gap: var(--sticky-stack-gap, 10px) !important;

  /* Bottom breathing room (between island and grid) */
  padding-bottom: var(--sticky-stack-gap, 10px) !important;
  box-sizing: border-box !important;
}

/* Remove legacy per-item margins that were creating uneven spacing */
#sticky-filters .filters-bar,
#sticky-filters .advanced-panel,
#sticky-filters .inline-reset-btn{
  margin: 0 !important;
}

/* Prevent flex-stretch from turning the reset pill into full-width */
#sticky-filters .inline-reset-btn{
  align-self: flex-start !important;
}

/* Advanced panel should not reserve any layout (or gap) when closed */
#advanced-panel.advanced-panel:not(.open):not(.closing){
  display: none !important;
  height: 0 !important;
}


/* =====================================================================
   Patch v105 (2026-01-15)
   Dolphin:
   - Advanced panel (#номер): when closing, the element remains in the flex
     column with height:0 until the transition ends. Flex `gap` still applies
     above it, so the user sees a blank spacer that disappears резко at the end.
   - Solution: during `.closing`, компенсируем верхний `gap` отрицательным
     margin-top so the effective spacing matches the final (display:none) state
     throughout the collapse.
   ===================================================================== */

#sticky-filters #advanced-panel.advanced-panel.closing{
  /* Cancel the parent flex gap above the panel while it animates to 0px */
  margin-top: calc(var(--sticky-stack-gap, 10px) * -1) !important;
}


/* =====================================================================
   Patch v106 (2026-01-15)
   Serious bug fix:
   - When user scrolls down (sticky island pinned) and opens ANY overlay/menu
     (gift sheet / filters modal / payment sheet), the sticky island "disappears"
     and the grid jumps upward.
   Root cause:
   - On iOS / Telegram WebView, `position: sticky` can break when ANY ancestor
     gets `overflow: hidden`. Our previous scroll-lock applied overflow hidden
     to html/body via `.overlay-open`, which disables sticky and causes layout
     reflow.
   Fix:
   - Keep html/body overflow intact during overlays; lock background scroll via
     JS event guards instead. Ensure the main scroller remains the scroll context.
   ===================================================================== */

html.overlay-open,
html.overlay-open body,
body.overlay-open{
  /* Do NOT set overflow:hidden here; it breaks position:sticky in TG iOS */
  overflow: visible !important;
}

html.overlay-open main,
body.overlay-open main,
html.overlay-open #ptr-content,
body.overlay-open #ptr-content{
  /* Keep the in-app scroller stable so sticky stays pinned */
  overflow-y: auto !important;
  overflow-x: hidden !important;
}


/* =====================================================================
   Patch v107 (2026-01-15)
   Fixes:
   1) Sticky "island" should NOT visually disappear when ANY overlay/menu opens.
      Root cause: later overrides forced overlay backdrops to cover the full
      viewport (top:0) and also pinned --overlay-top-offset to 0px (!important),
      so the backdrop always covered the sticky controls.
      Solution: always respect the dynamic --overlay-top-offset driven by JS.
   2) Advanced panel (#номер): remove the initial "jerk" on close.
      Root cause: gap-compensation via negative margin-top applied instantly.
      Solution: animate margin-top together with height.
   ===================================================================== */

/* 1) Restore dynamic backdrop top offset (keeps sticky controls visible). */
.modal-overlay::before,
.gift-sheet-overlay::before,
.pay-sheet-overlay::before,
.tonkeeper-overlay::before,
#payment-success-overlay::before,
#payment-fail-overlay::before,
#purchase-cancel-overlay::before,
#price-change-overlay::before,
.maintenance-overlay::before{
  /* Override older `inset: 0` / `top: 0` hard-forcing rules */
  inset: auto !important;
  top: var(--overlay-top-offset, 0px) !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* Ensure overlay containers stay transparent; only ::before paints the backdrop. */
.modal-overlay,
.gift-sheet-overlay,
.pay-sheet-overlay,
.tonkeeper-overlay,
#payment-success-overlay,
#payment-fail-overlay,
#purchase-cancel-overlay,
#price-change-overlay,
.maintenance-overlay{
  background: transparent !important;
}

/* 2) Advanced panel: animate the gap compensation instead of jumping. */
#advanced-panel.advanced-panel{
  transition:
    height 280ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    margin-top 280ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) !important;
}

/* =====================================================================
   Patch v108 (2026-01-16)
   Fix:
   - Sticky filters "island" (#sticky-filters) must not visually disappear
     behind overlays (WebView compositor bug: sticky layer gets dropped while
     the top area is kept undimmed via --overlay-top-offset).
   - Solution: lift #sticky-filters above overlays and force its own layer.
     We also disable pointer events while an overlay is open.
   ===================================================================== */

html.overlay-open #sticky-filters{
  z-index: 1205 !important; /* above overlays (1000) */
  transform: translate3d(0, 0, 0) !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  will-change: transform !important;
  pointer-events: none !important;
}


/* =====================================================================
   Patch v110 (2026-01-16)
   UI fixes:
   - Collection filter pill: text/icon perfectly vertically centered and never clipped.
   - Ensure all preview images inside filter buttons are vertically centered.
   ===================================================================== */

.filters-bar .filter-btn{
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

.filters-bar .filter-btn--single{
  align-items: center !important;
}

.filters-bar .filter-btn--single .filter-value{
  display: flex !important;
  align-items: center !important;
}

.filters-bar .filter-value-pill{
  display: inline-flex !important;
  align-items: center !important;
}

.filters-bar .filter-value-icon,
.filters-bar .filter-value-backdrop-dot{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.filters-bar .filter-value-icon img{
  display: block !important;
}

.filters-bar .filter-value-text{
  display: block !important;
  height: auto !important;
  line-height: 1.2 !important;
  padding-bottom: 1px !important; /* avoids descender clipping in TG/iOS */
}

/* =====================================================================
   Patch v113 (2026-01-16)
   Fix:
   - Balance pill amount: ensure PERFECT vertical centering inside the pill.
     The icon/+ were updated to 22px, while the amount still used a tighter
     line-height, which makes the text look "too high" optically.
   ===================================================================== */

.balance-pill{
  /* Keep the amount line box aligned to icon/+ size */
  min-height: 22px !important;
  line-height: 22px !important;
}

.balance-pill-amount{
  height: 22px !important;
  line-height: 22px !important;
  display: inline-flex !important;
  align-items: center !important;
}

.balance-pill-amount::after{
  line-height: 22px !important;
  display: inline-flex !important;
  align-items: center !important;
}

/* =====================================================================
   Patch v117 (2026-01-16)
   Fix:
   - Overlays (gift menu / filters modals / payment sheets) must dim the whole UI,
     including the sticky filters/search "island".
   - The island is frozen in JS during overlays (no jumps), so keep it BELOW the
     backdrop for correct dimming.
   ===================================================================== */

html.overlay-open #sticky-filters{
  /* Keep below overlays (z-index:1000) so it is dimmed by the backdrop */
  z-index: 60 !important;
  transform: none !important;
  will-change: auto !important;
  pointer-events: none !important;
}

html.overlay-open .modal-overlay::before,
html.overlay-open .gift-sheet-overlay::before,
html.overlay-open .pay-sheet-overlay::before,
html.overlay-open .tonkeeper-overlay::before,
html.overlay-open #payment-success-overlay::before,
html.overlay-open #payment-fail-overlay::before,
html.overlay-open #purchase-cancel-overlay::before,
html.overlay-open #price-change-overlay::before,
html.overlay-open .maintenance-overlay::before{
  /* Always dim from the very top */
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* =====================================================================
   Patch v118 (2026-01-17)
   Fix:
   - Pull-to-refresh must visually pull the whole list down (like native apps)
   - Spinner must NOT "spawn" via opacity; it should come into view by movement
   - Indicator must be only the spinner (no pill/background)
   ===================================================================== */

/* 1) The content must follow the finger (transform driven by --ptr-offset).
      Use translate3d for smooth compositing, and disable transitions while dragging. */
#ptr-content.ptr-content{
  transform: translate3d(0, var(--ptr-offset, 0px), 0) !important;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: transform;
}
#ptr-content.ptr-content.ptr-pulling{
  transition: none !important;
}

/* iOS had a hard-coded transform: translate3d(0,0,0) earlier to fight repaint.
   That killed the pull effect. Override it with the real offset. */
html.tg-webapp-ios #ptr-content{
  transform: translate3d(0, var(--ptr-offset, 0px), 0) !important;
}

/* 2) Indicator: always present but positioned above the viewport.
      It becomes visible naturally as --ptr-offset grows. */
#ptr-indicator.ptr-indicator{
  position: absolute !important;
  left: 0;
  right: 0;
  top: 0px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1500 !important;
  opacity: 1 !important;
}

/* Remove the "pill" completely: no background, no border, no shadow, no padding.
   Keep only the spinner, moved by --ptr-offset. */
#ptr-indicator .ptr-pill{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  opacity: 1 !important;
  transform: translate3d(0, calc(-56px + var(--ptr-offset, 0px)), 0) !important;
  transition: none !important;
}

/* 3) iPhone bottom clipping: if Telegram reports 0 bottom inset, the last row can
      sit under the home indicator / Telegram bottom chrome. Force a minimum. */
html.tg-webapp-ios .app-shell{
  padding-bottom: max(0px, 20px) !important;
}
html.tg-webapp-ios main{
  padding-bottom: calc(16px + max(0px, 20px)) !important;
}


/* =====================================================================
   Patch v125 (2026-01-18)
   Fix:
   - PTR: spinner must be fully hidden in idle (no always-on indicator)
   - Refresh UX: smooth swap + lightweight card enter animation
   ===================================================================== */

/* iOS bottom clipping: rely on JS-synced safe bottom; remove hardcoded 20px minimum from older patches. */
html.tg-webapp-ios .app-shell{
  padding-bottom: 0px !important;
}
html.tg-webapp-ios main{
  padding-bottom: calc(16px + 0px) !important;
}

/* Pull-to-refresh: hide indicator when idle; show only during pull/ready/refresh. */
#ptr-indicator.ptr-indicator{
  top: 0px !important;
  opacity: 0 !important;
}
#ptr-indicator.ptr-indicator.active,
#ptr-indicator.ptr-indicator.ready,
#ptr-indicator.ptr-indicator.refreshing{
  opacity: 1 !important;
}
#ptr-indicator .ptr-pill{
  transform: translate3d(0, calc(-56px + var(--ptr-offset, 0px)), 0) !important;
}

/* Smooth list refresh (fade swap) */
#gift-grid{
  transition: opacity 140ms ease-out !important;
}
#gift-grid.grid-swap--out{
  opacity: 0 !important;
}
#gift-grid.grid-swap--in{
  opacity: 1 !important;
}

/* Smooth card enter (uses existing @keyframes cardAppear declared earlier). */
.gift-card.gift-card--enter{
  animation: cardAppear 240ms ease-out both !important;
  animation-delay: var(--enter-delay, 0ms) !important;
}

@media (prefers-reduced-motion: reduce){
  #gift-grid{ transition: none !important; }
  .gift-card.gift-card--enter{ animation: none !important; }
}



/*
  1) iOS: make pull-to-refresh feel native (follow finger, then ease back).
  2) Keep the scroll content from being visually clipped under iOS UI chrome.
*/

#ptr-content{
  transform: translate3d(0, var(--ptr-offset, 0px), 0) !important;
  will-change: transform;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#ptr-content.ptr-pulling{
  transition: none !important;
}

#ptr-indicator .ptr-pill{
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 160ms ease-out !important;
}

/* --------------------------------------------------------------------------
   iOS (iPhone): lift actions inside sheets (no external gap).
   - Buttons move up slightly to avoid clipping by the home indicator.
   - The sheet still touches the bottom (no gap outside with overlay bg).
   Android + Desktop are intentionally unaffected.
   -------------------------------------------------------------------------- */
html.tg-phone.tg-webapp-ios .modal-overlay,
html.tg-phone.tg-webapp-ios .gift-sheet-overlay,
html.tg-phone.tg-webapp-ios .pay-sheet-overlay {
  padding-bottom: 0 !important;
}

/* Selection/filter modals: lift footer buttons a touch */
html.tg-phone.tg-webapp-ios .modal-footer {
  padding-bottom: calc(16px + 12px) !important;
}

/* These filter modals use a tighter footer baseline */
html.tg-phone.tg-webapp-ios #collections-modal .modal-footer,
html.tg-phone.tg-webapp-ios #models-modal .modal-footer,
html.tg-phone.tg-webapp-ios #backdrops-modal .modal-footer {
  padding-bottom: calc(14px + 12px) !important;
}

/* Other bottom sheets */
html.tg-phone.tg-webapp-ios .gift-sheet {
  padding-bottom: calc(14px + 12px) !important;
}
html.tg-phone.tg-webapp-ios .pay-sheet {
  padding-bottom: calc(16px + 12px) !important;
}
html.tg-phone.tg-webapp-ios .tonkeeper-sheet {
  padding-bottom: calc(18px + 12px) !important;
}

/* =====================================================================
   Public browser mode (outside Telegram WebApp)
   - No balance / no top-ups
   - Catalog (filters + cards) should occupy the full viewport
   ===================================================================== */
html.public-mode .topbar {
  display: none !important;
}

html.public-mode #balance-widget,
html.public-mode .balance-widget {
  display: none !important;
}

html.public-mode #balance-modal,
html.public-mode #topup-menu-overlay,
html.public-mode #payment-confirm-overlay {
  display: none !important;
}

html.public-mode #toast {
  display: none !important;
}

/* Public mode: make banner copy more prominent + centered */
html.public-mode .top-banner-overlay {
  background: rgba(0, 0, 0, 0.35) !important;
}
html.public-mode .top-banner-left {
  width: 100% !important;
  align-items: center !important;
  text-align: center !important;
}
html.public-mode .top-banner-title {
  letter-spacing: 0.6px;
}
html.public-mode .top-banner-handle {
  opacity: 0.95;
}

/* Public mode watermark (visible only outside Telegram WebApp) */
html.public-mode .public-watermark {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  background-repeat: repeat;
  /* Larger text and a smaller tile => watermark appears more often */
  background-size: 260px 180px;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='260'%20height='180'%3E%3Cg%20transform='rotate(-18%20130%2090)'%3E%3Ctext%20x='14'%20y='105'%20fill='white'%20fill-opacity='0.18'%20font-size='30'%20font-family='Arial'%3EFunPay%20%7C%20koorrekt%3C/text%3E%3C/g%3E%3C/svg%3E");
}
html:not(.public-mode) .public-watermark {
  display: none;
}

/* =====================================================================
   Patch v32 (2026-01-18)
   UI polish:
   - Fix minor glyph clipping in filter pills (top/bottom/side)
   - Fix minor glyph clipping in the top banner title/handle
   Notes:
   - Keep one-line truncation logic intact (do NOT change selection logic)
   ===================================================================== */

/* Filter pills: allow subpixel antialiasing beyond the box (Telegram WebView can clip it) */
.filters-bar .filter-btn{
  overflow: visible !important;
}

/* Ensure line boxes have enough headroom/descender room for SF Pro Display across WebViews */
.filters-bar .filter-label,
.filters-bar .filter-value{
  line-height: 1.3 !important;
  padding-top: 1px !important;
  padding-bottom: 1px !important;
  padding-left: 1px !important;
  padding-right: 1px !important;
}

/* Banner copy: avoid top cropping on some Android/iOS WebViews */
.top-banner-title,
.top-banner-handle{
  line-height: 1.28 !important;
  padding-top: 1px !important;
  padding-bottom: 2px !important;
}
