/**
 * MarketPlus — real mobile app shell
 * Only used when viewport ≤ 900px (.mp-mapp)
 */

.mp-mapp {
  display: none;
}

@media (max-width: 900px) {
  .mp-desktop,
  .mp-chat-fab {
    display: none !important;
  }

  /* Keep maintenance splash visible on mobile shell */
  body.mp-is-maintaining .mp-maintain {
    display: grid !important;
  }

  .mp-mapp {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    background: #f3f5f8;
    color: #111827;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  [data-theme="dark"] .mp-mapp {
    background: #0b0d12;
    color: #f3f4f6;
  }

  .mapp-top {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 12px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  [data-theme="dark"] .mapp-top {
    background: rgba(17, 20, 28, 0.94);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }

  .mapp-top__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .mapp-logo {
    height: 32px;
    width: auto;
    display: block;
  }

  .mapp-icon-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: #eef2f7;
    font-size: 1.1rem;
    cursor: pointer;
  }

  [data-theme="dark"] .mapp-icon-btn {
    background: #1c2230;
  }

  .mapp-search {
    display: flex;
    align-items: center;
    background: #eef2f7;
    border-radius: 14px;
    overflow: hidden;
    min-height: 46px;
  }

  [data-theme="dark"] .mapp-search {
    background: #1c2230;
  }

  .mapp-search input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: inherit;
    outline: none;
  }

  .mapp-hero__copy p {
    margin: 0;
    font-size: 0.82rem;
    opacity: 0.9;
    max-width: 28ch;
    line-height: 1.35;
  }

  .mapp-tab em {
    font-style: normal;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .mapp-search button {
    border: 0;
    background: #0A84FF;
    color: #fff;
    width: 48px;
    height: 46px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
  }

  .mapp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 14px 0 20px;
  }

  .mapp-hero {
    position: relative;
    margin: 0 16px;
    height: 180px;
    border-radius: 20px;
    overflow: hidden;
    isolation: isolate;
  }

  .mapp-hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .mapp-hero__copy {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    padding: 18px;
    background: linear-gradient(180deg, transparent 20%, rgba(8, 12, 20, 0.78) 100%);
    color: #fff;
  }

  .mapp-hero__copy span {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ffb070;
  }

  .mapp-hero__copy strong {
    font-size: 1.35rem;
    line-height: 1.2;
    font-weight: 800;
    max-width: 12ch;
  }

  .mapp-hero__cta {
    align-self: flex-start;
    margin-top: 6px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 8px 14px;
    cursor: pointer;
  }

  .mapp-cats {
    overflow: hidden;
  }

  .mapp-cats__track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0 16px 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mapp-cats__track::-webkit-scrollbar { display: none; }

  .mapp-cat {
    flex: 0 0 auto;
    display: grid;
    justify-items: center;
    gap: 6px;
    width: 64px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
  }

  .mapp-cat__ico {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  }

  [data-theme="dark"] .mapp-cat__ico {
    background: #171b24;
  }

  .mapp-cat.is-active .mapp-cat__ico {
    box-shadow: 0 0 0 2px #0A84FF;
  }

  .mapp-cat span {
    font-size: 0.68rem;
    font-weight: 650;
    text-align: center;
    color: #4b5563;
  }

  [data-theme="dark"] .mapp-cat span { color: #9ca3af; }

  .mapp-block {
    padding: 0 16px;
  }

  .mapp-block__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .mapp-block__head h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  .mapp-timer {
    font-size: 0.78rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #FF6A00;
    background: #fff0e6;
    padding: 6px 10px;
    border-radius: 999px;
  }

  [data-theme="dark"] .mapp-timer {
    background: #2a1a10;
  }

  .mapp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .mapp-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  }

  [data-theme="dark"] .mapp-card {
    background: #171b24;
  }

  .mapp-card__img {
    position: relative;
    aspect-ratio: 1;
    background: #eef2f7;
  }

  .mapp-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .mapp-card__badge {
    position: absolute;
    left: 8px;
    top: 8px;
    background: #FF6A00;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 7px;
    border-radius: 8px;
  }

  .mapp-card__wish {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.92);
    cursor: pointer;
  }

  .mapp-card__wish.is-active { color: #e53935; }

  .mapp-card__body {
    padding: 10px 10px 12px;
    display: grid;
    gap: 6px;
  }

  .mapp-card__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
  }

  .mapp-card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .mapp-card__price {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0A84FF;
  }

  .mapp-card__old {
    display: block;
    font-size: 0.68rem;
    color: #9ca3af;
    text-decoration: line-through;
  }

  .mapp-card__cart {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 11px;
    background: #e8f3ff;
    cursor: pointer;
    font-size: 0.95rem;
  }

  [data-theme="dark"] .mapp-card__cart {
    background: #132238;
  }

  .mapp-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #6b7280;
    padding: 28px 8px;
    font-size: 0.9rem;
  }

  .mapp-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.08);
  }

  [data-theme="dark"] .mapp-tabbar {
    background: rgba(17, 20, 28, 0.96);
    border-top-color: rgba(255, 255, 255, 0.06);
  }

  .mapp-tab {
    position: relative;
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 50px;
    border: 0;
    background: transparent;
    color: #6b7280;
    text-decoration: none;
    font-size: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mapp-tab span {
    font-size: 1.15rem;
    line-height: 1;
  }

  .mapp-tab.is-active {
    color: #0A84FF;
  }

  .mapp-tab.is-active em {
    color: #0A84FF;
  }

  .mapp-tab__badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 16px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #FF6A00;
    color: #fff;
    font-size: 0.6rem;
    display: grid;
    place-items: center;
  }

  /* Shared drawers sit above mobile shell */
  .mp-drawer {
    z-index: 200;
  }

  .mp-drawer__panel {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: min(82dvh, 82vh) !important;
    border-radius: 20px 20px 0 0 !important;
  }
}

@media (min-width: 901px) {
  .mp-mapp {
    display: none !important;
  }
}
