html.wc-telegram-mini-app .wc-hidden-telegram-action,
html.wc-telegram-mini-app .friendly-links-container {
  display: none !important;
}

html.wc-platform-switching body {
  opacity: 0;
}

html.wc-telegram-mini-app .wc-hidden-telegram-disclaimer {
  display: none !important;
}

@media (min-width: 901px) {
  html.wc-telegram-mini-app,
  html.wc-telegram-mini-app body,
  html.wc-telegram-mini-app #app {
    min-width: 0 !important;
    min-height: 100%;
    background: #f4f6fa;
  }

  html.wc-telegram-mini-app .wc-desktop-home {
    box-sizing: border-box;
    min-height: 100%;
    padding: 18px 22px 76px;
    background:
      radial-gradient(circle at 92% 0, rgba(233, 80, 157, .08), transparent 31%),
      #f5f7fb !important;
  }

  html.wc-telegram-mini-app .wc-desktop-summary {
    box-sizing: border-box;
    height: auto !important;
    min-height: 100px;
    margin: 0 0 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, .96);
    border: 1px solid #e7ebf2;
    border-radius: 20px;
    box-shadow: 0 8px 28px rgba(37, 47, 70, .07);
  }

  html.wc-telegram-mini-app .wc-desktop-summary > div {
    box-sizing: border-box;
    padding: 18px 22px !important;
  }

  html.wc-telegram-mini-app .wc-desktop-category-nav {
    margin: 0 0 14px !important;
  }

  html.wc-telegram-mini-app .wc-desktop-category-nav > div {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 10px !important;
    background: rgba(255, 255, 255, .96);
    border: 1px solid #e7ebf2;
    border-radius: 18px;
    box-shadow: 0 6px 20px rgba(37, 47, 70, .06);
  }

  html.wc-telegram-mini-app .wc-desktop-category-nav > div > div:first-child {
    flex: 0 0 auto;
  }

  html.wc-telegram-mini-app .wc-desktop-category-nav [style*="overflow-x"] {
    flex: 1 1 auto;
    gap: 4px;
  }

  html.wc-telegram-mini-app .wc-desktop-category-nav .ant-btn {
    width: auto !important;
    min-width: 104px !important;
    height: 42px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
  }

  html.wc-telegram-mini-app .wc-desktop-category-nav .ant-btn-primary {
    box-shadow: 0 6px 16px rgba(233, 80, 157, .22);
  }

  html.wc-telegram-mini-app .wc-desktop-template-shell {
    display: block !important;
  }

  html.wc-telegram-mini-app .wc-desktop-template-grid {
    box-sizing: border-box;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    grid-auto-rows: min-content;
    align-content: start;
    gap: 12px;
    height: calc(100vh - 278px) !important;
    min-height: 360px;
    padding: 14px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: #eef1f6 !important;
    border: 1px solid #e2e7ef;
    border-radius: 20px;
    scrollbar-gutter: stable;
  }

  html.wc-telegram-mini-app .wc-desktop-template-grid .itmeType2 {
    box-sizing: border-box;
    display: flex !important;
    align-items: center;
    width: auto !important;
    height: 76px !important;
    margin: 0 !important;
    padding: 13px 15px !important;
    overflow: hidden;
    color: #202735 !important;
    font-size: 15px;
    font-weight: 600;
    background: #fff !important;
    border: 1px solid #e5eaf1;
    border-radius: 16px !important;
    box-shadow: 0 3px 12px rgba(34, 44, 66, .05);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  }

  html.wc-telegram-mini-app .wc-desktop-template-grid .itmeType2:hover {
    color: #202735 !important;
    background: #fff !important;
    border-color: rgba(233, 80, 157, .45);
    box-shadow: 0 10px 24px rgba(34, 44, 66, .11);
    transform: translateY(-2px);
  }

  html.wc-telegram-mini-app .wc-desktop-template-grid .itmeType2 img {
    width: 46px !important;
    height: 46px !important;
    flex: 0 0 46px;
    margin-right: 12px;
    object-fit: contain;
    border-radius: 13px !important;
  }

  html.wc-telegram-mini-app .wc-desktop-template-footer {
    right: 24px !important;
    bottom: 16px !important;
    left: 24px !important;
    z-index: 1000;
    box-sizing: border-box;
    width: auto !important;
    padding: 0 !important;
    pointer-events: none;
  }

  html.wc-telegram-mini-app .wc-desktop-template-footer > div {
    justify-content: flex-end;
  }

  html.wc-telegram-mini-app .wc-desktop-template-footer > div > div:last-child {
    margin-left: 0 !important;
    pointer-events: auto;
  }

  html.wc-telegram-mini-app .wc-desktop-template-footer .ant-radio-group {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid #e4e9f1;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(34, 44, 66, .12);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  html.wc-telegram-mini-app .wc-desktop-template-footer .ant-radio-button-wrapper {
    height: 32px;
    line-height: 30px;
    border: 0 !important;
    border-radius: 8px !important;
  }

  html.wc-telegram-mini-app .wc-desktop-template-footer .ant-radio-button-wrapper::before {
    display: none !important;
  }
}

@media (max-width: 900px) {
  html.wc-telegram-mini-app,
  html.wc-telegram-mini-app body,
  html.wc-telegram-mini-app #app {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    background: #f7f8fc;
  }

  html.wc-telegram-mini-app * {
    box-sizing: border-box;
  }

  html.wc-telegram-mini-app button,
  html.wc-telegram-mini-app .ant-btn,
  html.wc-telegram-mini-app [role="button"] {
    touch-action: manipulation;
  }

  /* The cloned game banners were intentionally not included. Removing their
     empty carousel keeps the drawing template interface compact and clean. */
  html.wc-telegram-mini-app .ant-carousel[data-v-ccf970d2] {
    display: none !important;
  }

  html.wc-telegram-mini-app .container[data-v-ccf970d2] {
    width: 100% !important;
    height: 100dvh;
    padding-bottom: calc(52px + env(safe-area-inset-bottom));
    background: #f7f8fc;
  }

  html.wc-telegram-mini-app .main[data-v-ccf970d2] {
    width: 100% !important;
    margin-top: 0 !important;
    padding: 10px !important;
    border-radius: 0 !important;
  }

  html.wc-telegram-mini-app .wc-mobile-profile-bar {
    position: sticky;
    top: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    color: #202531;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid #edf0f5;
    box-shadow: 0 4px 18px rgba(42, 55, 82, .07);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  html.wc-telegram-mini-app .wc-mobile-profile-identity {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
  }

  html.wc-telegram-mini-app .wc-mobile-profile-identity > div:last-child {
    min-width: 0;
  }

  html.wc-telegram-mini-app .wc-mobile-profile-avatar {
    display: flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  html.wc-telegram-mini-app .wc-mobile-profile-title {
    font-size: 16px;
    line-height: 22px;
    font-weight: 700;
  }

  html.wc-telegram-mini-app .wc-mobile-profile-name {
    max-width: clamp(80px, 40vw, 160px);
    overflow: hidden;
    color: #7a8190;
    font-size: 12px;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.wc-telegram-mini-app .wc-mobile-trial {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 0 0 auto;
    color: #8b92a0;
    font-size: 11px;
    line-height: 16px;
  }

  html.wc-telegram-mini-app .wc-mobile-trial strong {
    color: #e9509d;
    font-size: 15px;
    line-height: 20px;
    font-variant-numeric: tabular-nums;
  }

  html.wc-telegram-mini-app .nav-container[data-v-ccf970d2] {
    height: calc(50px + env(safe-area-inset-bottom));
  }

  html.wc-telegram-mini-app .nav-bar[data-v-ccf970d2] {
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  html.wc-telegram-mini-app .main-context[data-v-e29c4978],
  html.wc-telegram-mini-app .main-context[data-v-8e1da4b9] {
    width: 100% !important;
    min-width: 0 !important;
    height: 100dvh !important;
    max-width: 100%;
    overscroll-behavior: contain;
  }

  html.wc-telegram-mini-app .main-context[data-v-e29c4978] > *,
  html.wc-telegram-mini-app .main-context[data-v-8e1da4b9] > * {
    max-width: 100% !important;
  }

  html.wc-telegram-mini-app .wc-mobile-editor {
    position: relative;
    display: block !important;
    height: calc(100dvh - 32px) !important;
    overflow: hidden !important;
    background: #f5f7fb;
  }

  html.wc-telegram-mini-app .wc-mobile-editor > .wc-mobile-editor-settings,
  html.wc-telegram-mini-app .wc-mobile-editor > .wc-mobile-editor-actions,
  html.wc-telegram-mini-app .wc-mobile-editor > .wc-mobile-editor-drawer-head {
    display: none !important;
  }

  html.wc-telegram-mini-app .wc-mobile-editor > .wc-mobile-editor-preview {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 12px 0 calc(76px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    background: #f5f7fb;
    -webkit-overflow-scrolling: touch;
  }

  /* The upstream H5 renderer sometimes forces its 1300px canvas back to
     scale(1), which makes Telegram show only a cropped corner. Keep the
     original drawing pixels untouched while fitting its visual preview to the
     current WebApp width. */
  html.wc-telegram-mini-app .wc-mobile-editor-preview > .wc-mobile-preview-scale {
    width: var(--wc-mobile-preview-width, 1300px) !important;
    height: var(--wc-mobile-preview-height, auto) !important;
    max-width: none !important;
    margin: 0 !important;
    overflow: visible !important;
    transform: scale(var(--wc-mobile-preview-scale, .3)) !important;
    transform-origin: top left !important;
  }

  html.wc-telegram-mini-app .wc-mobile-canvas {
    position: relative !important;
  }

  html.wc-telegram-mini-app .wc-mobile-canvas > .wc-mobile-canvas-bottom-decoration {
    position: absolute !important;
    right: auto !important;
    bottom: 0 !important;
    left: 0 !important;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-preview > .wc-mobile-preview-scale.wc-mobile-preview-exporting {
    position: fixed !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    left: -20000px !important;
    height: auto !important;
    transform: scale(1) !important;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-preview > .wc-mobile-preview-export-mirror {
    pointer-events: none !important;
  }

  html.wc-telegram-mini-app .wc-mobile-editor.wc-settings-open > .wc-mobile-editor-drawer-head {
    position: fixed;
    top: 32px;
    right: 0;
    left: 0;
    z-index: 2147483300;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 16px;
    color: #202531;
    background: rgba(255, 255, 255, .98);
    border-bottom: 1px solid #edf0f5;
    box-shadow: 0 5px 20px rgba(32, 42, 65, .08);
  }

  html.wc-telegram-mini-app .wc-mobile-editor-drawer-head strong {
    font-size: 17px;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-drawer-close {
    min-width: 62px;
    color: #e9509d !important;
    background: #fff0f7 !important;
    border-color: #ffd1e7 !important;
  }

  html.wc-telegram-mini-app .wc-mobile-editor.wc-settings-open > .wc-mobile-editor-settings {
    position: fixed;
    top: 82px;
    right: 0;
    bottom: calc(178px + env(safe-area-inset-bottom));
    left: 0;
    z-index: 2147483100;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    padding: 8px 10px 20px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: #f7f8fc;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  html.wc-telegram-mini-app .wc-mobile-editor.wc-settings-open > .wc-mobile-editor-actions {
    position: fixed;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 0;
    z-index: 2147483200;
    display: block !important;
    width: 100% !important;
    height: 114px !important;
    padding: 8px 10px !important;
    overflow: auto !important;
    background: rgba(255, 255, 255, .98);
    border-top: 1px solid #edf0f5;
    box-shadow: 0 -5px 18px rgba(32, 42, 65, .08);
  }

  html.wc-telegram-mini-app .wc-mobile-editor-settings .listMobile {
    padding: 3px !important;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-settings .mobileButton {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 8px !important;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-settings .ant-btn-sm {
    min-height: 32px;
    margin: 3px 1px;
    padding: 3px 9px;
    font-size: 13px;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-toolbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2147483400;
    display: grid;
    grid-template-columns: .85fr .85fr 1.5fr;
    gap: 7px;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid #e8ebf1;
    box-shadow: 0 -8px 28px rgba(32, 42, 65, .13);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  html.wc-telegram-mini-app .wc-mobile-editor-tool {
    min-width: 0;
    height: 46px;
    padding: 0 8px;
    color: #525967;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    background: #f3f5f8;
    border: 1px solid #e5e8ee;
    border-radius: 13px;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-tool.is-secondary {
    color: #d93e8b;
    background: #fff0f7;
    border-color: #ffd2e7;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-tool.is-primary {
    color: #fff;
    background: linear-gradient(135deg, #ee58a3, #df3b8d);
    border-color: transparent;
    box-shadow: 0 5px 14px rgba(233, 80, 157, .26);
  }

  html.wc-telegram-mini-app .wc-mobile-editor-tool:disabled {
    cursor: wait;
    opacity: .72;
  }

  html.wc-telegram-mini-app .wc-mobile-editor-toast {
    position: fixed;
    right: 16px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 16px;
    z-index: 2147483450;
    max-width: 460px;
    margin: 0 auto;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    background: rgba(38, 43, 54, .94);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(25, 31, 44, .24);
  }

  html.wc-telegram-mini-app .wc-mobile-editor-toast.is-success {
    background: rgba(25, 153, 104, .96);
  }

  html.wc-telegram-mini-app .wc-mobile-editor-toast.is-error {
    background: rgba(207, 61, 91, .96);
  }

  html.wc-telegram-mini-app .wc-mobile-editor-settings-button.is-active {
    color: #d93e8b;
    background: #fff0f7;
    border-color: #ffd2e7;
  }

  html.wc-telegram-mini-app .ant-modal {
    width: calc(100vw - 24px) !important;
    max-width: 560px !important;
    margin: 12px auto !important;
    top: max(8px, env(safe-area-inset-top)) !important;
  }

  html.wc-telegram-mini-app .ant-drawer-content-wrapper {
    max-width: 100vw !important;
  }
}
