:root{
    --bg:#121214;
    --surface:#1C1D22;
    --surface-2:#26272D;
    --stroke:#2E2F36;
    --text:#F5F3F2;
    --text-soft:#9A98A3;
    --accent:#FF4D6D;
    --accent-2:#FFC857;
  }

  *{box-sizing:border-box; margin:0; padding:0;}
  html{scroll-behavior:smooth;}

  body{
    background:var(--bg);
    color:var(--text);
    font-family:'Manrope', -apple-system, sans-serif;
    line-height:1.5;
    -webkit-font-smoothing:antialiased;
    max-width:520px;
    margin:0 auto;
    min-height:100vh;
  }

  a{color:inherit; text-decoration:none;}
  img{max-width:100%; display:block;}
  button{font-family:inherit; cursor:pointer; border:none; background:none; color:inherit;}
  input, textarea{font-family:inherit;}
  svg{display:block;}

  .wrap{padding:0 18px;}

  :focus-visible{outline:2px solid var(--accent); outline-offset:2px;}

  /* ---------- Header ---------- */

  header{
    position:relative;
    padding:20px 0 6px;
    overflow:hidden;
  }
  header::before{
    content:"";
    position:absolute;
    top:-120px; left:50%;
    transform:translateX(-50%);
    width:340px; height:240px;
    background:radial-gradient(closest-side, rgba(255,77,109,0.22), transparent 72%);
    pointer-events:none;
  }

  .header-row{
    position:relative;
    z-index:1;
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:16px;
  }

  .greeting{font-size:17px; font-weight:800; color:var(--text);}
  .greeting-sub{display:block; font-size:12px; font-weight:500; color:var(--text-soft); margin-top:2px;}

  .search-wrap{
    position:relative;
    z-index:1;
    display:flex;
    align-items:center;
    gap:10px;
    background:var(--surface);
    border:1px solid var(--stroke);
    border-radius:12px;
    padding:11px 14px;
  }
  .search-wrap:focus-within{border-color:var(--accent);}
  .search-wrap svg{width:17px; height:17px; color:var(--text-soft); flex-shrink:0;}
  .search-wrap input{
    flex:1;
    min-width:0;
    border:none;
    outline:none;
    background:none;
    font-size:14px;
    font-weight:500;
    color:var(--text);
  }
  .search-wrap input::placeholder{color:var(--text-soft);}

  .search-clear{
    display:none;
    width:19px; height:19px;
    border-radius:50%;
    background:var(--stroke);
    color:var(--text-soft);
    align-items:center;
    justify-content:center;
    flex-shrink:0;
  }
  .search-clear svg{width:10px; height:10px;}
  .search-clear.show{display:flex;}

  /* ---------- Story-circle spotlight nav ---------- */

  .stories{
    display:flex;
    gap:14px;
    overflow-x:auto;
    padding:14px 0 6px;
    scrollbar-width:none;
  }
  .stories::-webkit-scrollbar{display:none;}

  .story{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:6px;
    flex-shrink:0;
    width:62px;
  }
  .story-ring{
    width:58px; height:58px;
    border-radius:50%;
    padding:2.5px;
    background:conic-gradient(from 180deg, var(--accent), var(--accent-2), var(--accent));
    display:flex;
    align-items:center;
    justify-content:center;
    transition:transform 0.15s ease;
  }
  .story:active .story-ring{transform:scale(0.92);}
  .story-avatar{
    width:100%; height:100%;
    border-radius:50%;
    object-fit:cover;
    border:2.5px solid var(--bg);
    display:block;
  }
  .story-label{
    font-size:10.5px;
    font-weight:600;
    color:var(--text-soft);
    text-align:center;
    max-width:62px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  /* ---------- Catalog ---------- */

  .catalog{padding:8px 0 40px;}

  .catalog-bar{
    display:flex;
    align-items:baseline;
    gap:8px;
    margin:14px 0 12px;
  }
  .catalog-title{font-size:16px; font-weight:800; color:var(--text);}
  .catalog-count{font-size:12px; font-weight:600; color:var(--text-soft);}

  .filters{
    display:flex;
    gap:8px;
    overflow-x:auto;
    margin-bottom:16px;
    scrollbar-width:none;
  }
  .filters::-webkit-scrollbar{display:none;}

  .filter-btn{
    flex-shrink:0;
    background:var(--surface);
    color:var(--text-soft);
    font-size:12.5px;
    font-weight:600;
    padding:8px 16px;
    border-radius:999px;
    border:1px solid var(--stroke);
    transition:background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .filter-btn.active{background:var(--text); color:var(--bg); border-color:var(--text);}

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

  .item{
    position:relative;
    display:flex;
    flex-direction:column;
    background:var(--surface);
    border:1px solid var(--stroke);
    border-radius:16px;
    padding:10px 10px 50px;
    transition:box-shadow 0.25s ease, transform 0.15s ease;
  }
  .item.hidden{display:none;}
  .item.spotlight{animation:spotlightPulse 1.4s ease;}

  @keyframes spotlightPulse{
    0%{box-shadow:0 0 0 0 rgba(255,77,109,0.55); transform:scale(1);}
    30%{box-shadow:0 0 0 8px rgba(255,77,109,0.16); transform:scale(1.02);}
    100%{box-shadow:0 0 0 0 rgba(255,77,109,0); transform:scale(1);}
  }
  @media (prefers-reduced-motion: reduce){
    .item.spotlight{animation:none;}
  }

  .item-photo{
    aspect-ratio:1/1;
    border-radius:11px;
    overflow:hidden;
    margin-bottom:10px;
    background:var(--surface-2);
  }
  .item-photo img{width:100%; height:100%; object-fit:cover;}

  .item-price{font-size:16px; font-weight:800; color:var(--text); margin-bottom:3px; padding-right:34px;}

  .item-title{
    font-size:12px;
    font-weight:500;
    color:var(--text-soft);
    line-height:1.4;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    min-height:34px;
    padding-right:34px;
  }

  .item-rating{
    display:flex;
    align-items:center;
    gap:4px;
    font-size:11.5px;
    font-weight:600;
    color:var(--text-soft);
    margin-top:6px;
  }
  .item-rating .i-star{width:12px; height:12px; color:var(--accent-2);}

  .cart-fab-wrap{
    position:absolute;
    bottom:9px; right:9px;
    z-index:4;
    display:flex;
    align-items:center;
    gap:8px;
    pointer-events:none;
  }

  .cart-fab-price{
    opacity:0;
    transform:translateX(8px) scale(0.85);
    background:var(--text);
    color:var(--bg);
    font-size:11px;
    font-weight:800;
    padding:6px 11px;
    border-radius:999px;
    white-space:nowrap;
    box-shadow:0 8px 18px -8px rgba(0,0,0,0.5);
    transition:opacity 0.25s ease, transform 0.25s ease;
  }
  .cart-fab-price.show{opacity:1; transform:translateX(0) scale(1);}

  .cart-fab{
    pointer-events:auto;
    flex-shrink:0;
    width:38px; height:38px;
    border-radius:50%;
    background:linear-gradient(135deg, var(--accent), var(--accent-2));
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    box-shadow:0 12px 24px -8px rgba(255,77,109,0.65);
    transition:transform 0.15s ease;
  }
  .cart-fab svg{width:18px; height:18px;}
  .cart-fab .icon-check{display:none;}
  .cart-fab:active{transform:scale(0.85);}
  .cart-fab.active .icon-plus{display:none;}
  .cart-fab.active .icon-check{display:block;}

  /* ---------- Overlay ---------- */

  .overlay{
    position:fixed; inset:0;
    background:rgba(0,0,0,0.55);
    opacity:0;
    pointer-events:none;
    transition:opacity 0.25s ease;
    z-index:40;
  }
  .overlay.open{opacity:1; pointer-events:auto;}

  /* ---------- Bottom sheets ---------- */

  .sheet{
    position:fixed;
    left:0; right:0; bottom:0;
    margin:0 auto;
    max-width:520px;
    max-height:86vh;
    background:var(--surface);
    border-radius:20px 20px 0 0;
    z-index:50;
    transform:translateY(100%);
    transition:transform 0.32s cubic-bezier(.22,.68,0,1);
    display:flex;
    flex-direction:column;
    box-shadow:0 -24px 60px -20px rgba(0,0,0,0.6);
  }
  .sheet.open{transform:translateY(0);}

  .sheet-handle{width:36px; height:4px; background:var(--stroke); border-radius:999px; margin:10px auto 2px; flex-shrink:0;}

  .sheet-head{
    flex-shrink:0;
    padding:10px 20px 14px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    border-bottom:1px solid var(--stroke);
  }
  .sheet-head h3{font-size:16px; font-weight:800;}

  .close-btn{
    width:28px; height:28px;
    border-radius:8px;
    background:var(--surface-2);
    color:var(--text-soft);
    display:flex; align-items:center; justify-content:center;
  }
  .close-btn svg{width:13px; height:13px;}

  .sheet-body{flex:1; overflow-y:auto; padding:16px 20px 100px;}

  .cart-empty{color:var(--text-soft); font-size:13px; text-align:center; padding:50px 0;}

  .cart-row{display:flex; gap:12px; align-items:center; padding:12px 0; border-bottom:1px solid var(--stroke);}
  .cart-row img{width:52px; height:52px; border-radius:9px; object-fit:cover; flex-shrink:0;}
  .cart-row-info{flex:1; min-width:0;}
  .cart-row-title{font-size:13px; font-weight:600; line-height:1.3; margin-bottom:6px; color:var(--text);}
  .cart-row-price{font-size:12.5px; color:var(--text-soft);}

  .qty-control{display:flex; align-items:center; gap:8px; background:var(--surface-2); border-radius:999px; padding:4px;}
  .qty-control button{width:22px; height:22px; border-radius:50%; background:var(--surface); font-size:14px; font-weight:800; color:var(--accent); display:flex; align-items:center; justify-content:center;}
  .qty-control span{font-size:13px; font-weight:700; min-width:14px; text-align:center; color:var(--text);}

  .cart-total-row{display:flex; justify-content:space-between; align-items:baseline; padding:16px 0 4px; font-size:14px; font-weight:700; color:var(--text-soft);}
  .cart-total-row span:last-child{font-size:19px; color:var(--text);}

  .field{margin-bottom:12px;}
  .field label{display:block; font-size:12px; font-weight:600; color:var(--text-soft); margin-bottom:6px;}
  .field input, .field textarea{
    width:100%;
    background:var(--surface-2);
    border:1px solid var(--stroke);
    border-radius:10px;
    padding:11px 13px;
    font-size:14px;
    color:var(--text);
    resize:none;
  }
  .field input:focus, .field textarea:focus{outline:none; border-color:var(--accent);}

  .profile-orders{margin-top:20px; padding-top:16px; border-top:1px solid var(--stroke);}
  .profile-orders h4{font-size:11.5px; font-weight:800; margin-bottom:10px; color:var(--text-soft); text-transform:uppercase; letter-spacing:0.03em;}
  .order-card{background:var(--surface-2); border-radius:10px; padding:12px 14px; margin-bottom:10px; font-size:13px;}
  .order-card .oc-date{color:var(--text-soft); font-size:11px; margin-bottom:4px; font-weight:700;}
  .order-card .oc-items{margin-bottom:6px; line-height:1.4; color:var(--text);}
  .order-card .oc-total{font-weight:800; color:var(--accent-2);}
  .profile-contact{margin-top:18px; font-size:12.5px; color:var(--text-soft); text-align:center;}
  .profile-contact a{color:var(--accent); font-weight:700;}

  .toast{
    position:fixed;
    bottom:24px; left:50%;
    transform:translateX(-50%) translateY(16px);
    background:var(--text);
    color:var(--bg);
    font-size:13px;
    font-weight:700;
    padding:12px 20px;
    border-radius:999px;
    z-index:80;
    opacity:0;
    pointer-events:none;
    transition:all 0.25s ease;
    max-width:88vw;
    text-align:center;
  }
  .toast.open{opacity:1; transform:translateX(-50%) translateY(0);}

  /* ---------- Pinned action button (native MainButton or fallback) ---------- */

  .pinned-btn{
    display:none;
    position:fixed;
    left:16px; right:16px;
    bottom:calc(96px + env(safe-area-inset-bottom));
    max-width:488px;
    margin:0 auto;
    z-index:58;
    background:var(--accent);
    color:#fff;
    font-size:14.5px;
    font-weight:800;
    padding:15px;
    border-radius:14px;
    text-align:center;
    box-shadow:0 16px 34px -12px rgba(255,77,109,0.55);
  }
  .pinned-btn.show{display:block;}
  .pinned-btn:active{transform:scale(0.98);}

  /* ---------- Bottom navigation (attached, native app-style) ---------- */

  body{padding-bottom:104px;}

  .bottom-nav{
    position:fixed;
    left:14px; right:14px;
    bottom:calc(14px + env(safe-area-inset-bottom));
    max-width:492px;
    margin:0 auto;
    z-index:56;
    display:flex;
    align-items:center;
    justify-content:space-between;
    background:rgba(28,29,34,0.88);
    backdrop-filter:blur(18px);
    -webkit-backdrop-filter:blur(18px);
    border:1px solid var(--stroke);
    border-radius:24px;
    padding:10px 22px;
    box-shadow:0 20px 50px -18px rgba(0,0,0,0.65);
  }

  .nav-item{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:4px;
    font-size:10.5px;
    font-weight:600;
    color:var(--text-soft);
    padding:2px 8px;
    transition:color 0.2s ease, transform 0.15s ease;
  }
  .nav-item svg{width:21px; height:21px;}
  .nav-item.active{color:var(--text);}
  .nav-item:active{transform:scale(0.92);}

  .nav-cart-btn{
    position:relative;
    width:54px; height:54px;
    border-radius:50%;
    margin-top:-30px;
    flex-shrink:0;
    background:linear-gradient(135deg, var(--accent), var(--accent-2));
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    box-shadow:0 14px 30px -8px rgba(255,77,109,0.65), 0 0 0 5px var(--bg);
    transition:transform 0.2s ease;
  }
  .nav-cart-btn svg{width:22px; height:22px;}
  .nav-cart-btn:active{transform:scale(0.92);}
  .nav-cart-btn.bump{animation:cartBump 0.45s ease;}

  @keyframes cartBump{
    0%{transform:scale(1) rotate(0);}
    35%{transform:scale(1.16) rotate(-8deg);}
    65%{transform:scale(0.94) rotate(5deg);}
    100%{transform:scale(1) rotate(0);}
  }
  @media (prefers-reduced-motion: reduce){
    .nav-cart-btn.bump{animation:none;}
  }

  .nav-cart-badge{
    position:absolute;
    top:-3px; right:-4px;
    background:var(--text);
    color:var(--bg);
    font-size:10.5px;
    font-weight:800;
    min-width:18px; height:18px;
    border-radius:999px;
    display:none;
    align-items:center;
    justify-content:center;
    padding:0 4px;
    border:2px solid var(--bg);
  }

  body.has-pinned-btn .sheet-body{padding-bottom:170px;}
