/* Giao diện điện thoại của app (màn hình hẹp): thanh trên gọn, thanh điều hướng dưới như app thật, nội dung thu nhỏ cho vừa tay.
   Chỉ áp dụng khi màn hình <= 900px; máy tính giữ nguyên. */
@media (max-width: 900px){
  html.theme-clean{--m-top:56px;--m-bottom:76px;}

  /* ----- Khung: thanh trên (logo + tài khoản) và thanh dưới (4 mục chính) ----- */
  html.theme-clean .app-sidebar{display:contents !important;}
  html.theme-clean .app-sidebar::before{content:"";position:fixed;top:0;left:0;right:0;height:var(--m-top);background:#232323 !important;border-bottom:1px solid #363636;z-index:70;}
  html.theme-clean .app-sidebar .sidebar-logo{position:fixed !important;top:0;left:0;height:var(--m-top);padding:0 16px !important;margin:0 !important;display:flex !important;align-items:center;gap:10px;z-index:72;background:transparent !important;border:0 !important;}
  html.theme-clean .app-sidebar .sidebar-logo img{width:32px !important;height:32px !important;}
  html.theme-clean .app-sidebar .sidebar-logo span,html.theme-clean .app-sidebar .sidebar-logo{font-size:18px;}

  /* Tài khoản: chỉ còn ảnh và danh hiệu ở góc phải thanh trên */
  html.theme-clean .app-sidebar .sidebar-footer{position:fixed !important;top:0;right:0;height:var(--m-top);padding:0 12px !important;margin:0 !important;display:flex !important;align-items:center;z-index:72;background:transparent !important;border:0 !important;width:auto !important;}
  html.theme-clean .app-sidebar .sidebar-footer .acct-card{padding:5px 8px !important;gap:8px;width:auto !important;border-radius:999px !important;}
  html.theme-clean .app-sidebar,html.theme-clean .app-sidebar .sidebar-footer,html.theme-clean .app-sidebar .sidebar-footer .auth-widget{overflow:visible !important;}
  html.theme-clean .app-sidebar .sidebar-footer .acct-info,html.theme-clean .app-sidebar .sidebar-footer .acct-chev{display:none !important;}
  html.theme-clean .app-sidebar .sidebar-footer .acct-menu{top:calc(100% + 6px) !important;bottom:auto !important;right:12px !important;left:auto !important;min-width:180px;z-index:80;}
  html.theme-clean .app-sidebar .sidebar-footer .auth-widget .btn,html.theme-clean .app-sidebar .sidebar-footer a,html.theme-clean .app-sidebar .sidebar-footer button.btn{padding:8px 14px !important;font-size:13px !important;}

  /* Thanh dưới: Scan, Workspace, Profile, Community */
  html.theme-clean .app-sidebar .sidebar-scroll{position:fixed !important;left:0;right:0;bottom:0;top:auto !important;height:auto !important;display:flex !important;flex-direction:row !important;justify-content:space-around;align-items:stretch;gap:0 !important;padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px)) !important;margin:0 !important;overflow:visible !important;z-index:70;background:#232323 !important;border-top:1px solid #363636 !important;}
  html.theme-clean .app-sidebar .sidebar-scroll .sidebar-nav,html.theme-clean .app-sidebar .sidebar-scroll nav,html.theme-clean .app-sidebar #sidebarNav{display:contents !important;}
  html.theme-clean .app-sidebar .sidebar-group-label,html.theme-clean .app-sidebar .sidebar-nav-indicator{display:none !important;}
  html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link,html.theme-clean .app-sidebar .sidebar-scroll .sidebar-nav a.sidebar-link{flex:1 1 0 !important;min-width:0 !important;width:auto !important;max-width:none !important;box-sizing:border-box;display:flex !important;flex-direction:column !important;align-items:center;justify-content:center;gap:3px !important;padding:7px 2px !important;margin:0 !important;border-radius:12px !important;font-size:11px !important;font-weight:500;line-height:1.2;text-align:center;white-space:nowrap;overflow:hidden;}
  html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link i{font-size:22px !important;margin:0 !important;}
  html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link span{font-size:9.5px !important;letter-spacing:-.1px;white-space:normal !important;line-height:1.1;overflow-wrap:anywhere;overflow:hidden;text-overflow:ellipsis;max-width:100%;}
  html.theme-clean .app-sidebar .sidebar-link .ti-lock{display:none !important;}
  html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link[href="index.html"],html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link[href="guide.html"],html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link[href="contact.html"]{display:none !important;}
  html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link.active{background:rgba(35,33,44,.14) !important;}
  html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link[style*="display:none"],html.theme-clean .app-sidebar .sidebar-scroll a.sidebar-link[style*="display: none"]{display:none !important;}

  /* Chừa chỗ cho hai thanh cố định */
  html.theme-clean main,html.theme-clean .app-main{padding-top:var(--m-top) !important;padding-bottom:calc(var(--m-bottom) + env(safe-area-inset-bottom,0px)) !important;}
  html.theme-clean html,html.theme-clean body{overflow-x:hidden;}

  /* Bong bóng hỗ trợ nằm trên thanh dưới, nhỏ hơn */
  html.theme-clean .lsw-root{bottom:calc(var(--m-bottom) + 10px + env(safe-area-inset-bottom,0px)) !important;right:12px !important;}
  html.theme-clean .lsw-fab{width:50px !important;height:50px !important;}
  html.theme-clean .lsw-fab .lsw-cat{width:36px !important;height:36px !important;}

  /* ----- Nội dung: thu nhỏ khoảng cách và chữ ----- */
  html.theme-clean .app-section{padding:12px 0 24px !important;}
  html.theme-clean .app-section .container{padding:12px 14px !important;}
  html.theme-clean .page-head,html.theme-clean #niche-scan .scan-head{margin:0 0 14px !important;padding:0 !important;}
  html.theme-clean #niche-scan .page-head h1,html.theme-clean #niche-scan .scan-head h1,html.theme-clean .app-section .page-head h1,html.theme-clean #workspace .ws-head h1,html.theme-clean #profile .pf-head h1{font-size:26px !important;line-height:1.15 !important;margin:0 0 6px !important;letter-spacing:-.01em;}
  html.theme-clean .page-head p,html.theme-clean #workspace .ws-head p{font-size:14px !important;line-height:1.5;}
  html.theme-clean .page-kicker{font-size:11px;}

  /* Khung tìm kiếm / Discover */
  html.theme-clean #niche-scan .scan-card,html.theme-clean #niche-scan .demo-box{padding:14px !important;border-radius:16px !important;}
  html.theme-clean .scan-search{flex-wrap:wrap !important;}
  html.theme-clean .scan-search input{font-size:16px !important;min-width:0;flex:1 1 60%;}
  html.theme-clean .scan-search .scan-go,html.theme-clean .scan-search .btn{width:100%;flex:1 1 100%;}  /* 16px để iPhone không tự phóng to khi chạm vào */
  html.theme-clean .scan-topics{gap:6px !important;}
  html.theme-clean .topic-chip{padding:6px 12px !important;font-size:13px !important;}
  html.theme-clean #unifiedSearchBtn{width:100%;justify-content:center;}

  /* Ba lựa chọn quét: mỗi thẻ gọn một dòng, chạm dễ */
  html.theme-clean .age-split{gap:8px !important;margin:12px 0 !important;}
  html.theme-clean .age-tab{padding:12px 14px !important;gap:12px !important;border-radius:14px !important;}
  html.theme-clean .age-ic{width:40px !important;height:40px !important;border-radius:11px !important;}
  html.theme-clean .age-ic i{font-size:20px !important;}
  html.theme-clean .age-tx b{font-size:15px !important;}
  html.theme-clean .age-tx small{font-size:12px !important;}
  html.theme-clean .age-tab em{padding:4px 9px !important;font-size:11px !important;}

  /* Thẻ kênh */
  html.theme-clean .nc{padding:14px !important;border-radius:16px !important;}
  html.theme-clean .nc-head{display:grid !important;grid-template-columns:52px 1fr 60px;gap:6px 12px !important;align-items:center;}
  html.theme-clean .nc-head .nc-id{display:contents !important;}
  html.theme-clean .nc-head .nc-avatar{grid-column:1;grid-row:1 / 3;width:52px !important;height:52px !important;}
  html.theme-clean .nc-head .nc-name{grid-column:2;grid-row:1;flex-wrap:wrap;gap:6px !important;min-width:0;}
  html.theme-clean .nc-head .nc-name .name{font-size:17px !important;overflow-wrap:anywhere;}
  html.theme-clean .nc-head .nc-handle{grid-column:2;grid-row:2;flex-wrap:wrap;gap:4px 10px;font-size:12.5px;}
  html.theme-clean .nc-head .nc-score{grid-column:3;grid-row:1 / 3;width:60px !important;height:60px !important;}
  html.theme-clean .nc-head .nc-pill{grid-column:1 / -1;grid-row:3;justify-self:start;font-size:12.5px !important;}
  html.theme-clean .nc-head .nc-niche{grid-column:1 / -1;grid-row:4;justify-self:start;}
  html.theme-clean .nc-kpis{grid-template-columns:1fr 1fr !important;}
  html.theme-clean .nc-kpi{padding:11px 12px !important;border-right:1px solid #3E4046 !important;border-bottom:1px solid #3E4046 !important;}
  html.theme-clean .nc-kpi-label{white-space:normal !important;font-size:11.5px !important;}
  html.theme-clean .nc-kpi-value{font-size:17px !important;}
  html.theme-clean .nc-kpi.money{grid-column:auto !important;}
  html.theme-clean .nc-kpi.money .nc-kpi-value{font-size:18px !important;}
  html.theme-clean .nc-kpi:last-child{grid-column:1 / -1;border-bottom:0 !important;}
  /* Số tiền ước tính (vd. $640–$2.2K) bị cắt ở nửa hàng: cho ô tiền chiếm trọn hàng đầu, đủ chỗ cho chữ to; bốn ô còn lại xếp hai cột */
  html.theme-clean:not(#a):not(#b):not(#c) .nc-kpi.money{grid-column:1 / -1 !important;order:-1;border-right:0 !important;}
  html.theme-clean:not(#a):not(#b):not(#c) .nc-kpi.money .nc-kpi-value{font-size:28px !important;white-space:normal !important;overflow-wrap:anywhere;}
  html.theme-clean:not(#a):not(#b):not(#c) .nc-kpi:last-child:not(.money){grid-column:auto !important;}
  html.theme-clean .nc-body{grid-template-columns:1fr !important;gap:12px !important;}
  html.theme-clean .niche-video-row{display:flex !important;overflow-x:auto;gap:10px !important;padding-bottom:6px;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;}
  html.theme-clean .nc .niche-video-row .niche-video-card{flex:0 0 152px !important;width:152px !important;min-width:152px !important;max-width:none !important;scroll-snap-align:start;}
  html.theme-clean .nc .niche-video-thumb-wrap{width:100% !important;aspect-ratio:16/9;height:auto !important;}
  html.theme-clean .hr-chart-head{flex-direction:column;align-items:flex-start;}
  html.theme-clean .nc .btn,html.theme-clean .nc-foot .btn{padding:9px 12px !important;font-size:13px !important;}

  /* Workspace: tab ngang cuộn được, dính dưới thanh trên */
  html.theme-clean #workspace .ws-steps{top:calc(var(--m-top) + 6px) !important;margin:0 -2px 14px !important;}
  html.theme-clean #workspace .ws-step{min-width:128px !important;padding:9px 10px !important;}
  html.theme-clean #workspace .ws-step .t small{display:none;}
  html.theme-clean #workspace .ws-step .ws-badge{position:static !important;margin-left:auto;flex:none;}
  html.theme-clean #workspace .ws-step .t{min-width:0;flex:1;}
  html.theme-clean #workspace .ws-addlink,html.theme-clean #workspace .ws-form{flex-direction:column;}
  html.theme-clean #workspace .ws-addlink input,html.theme-clean #workspace .ws-form input{font-size:16px;}
  html.theme-clean #workspace .saved-toolbar{flex-direction:column;align-items:stretch;}
  html.theme-clean #workspace .saved-toolbar-actions .btn{flex:1;}

  /* Profile */
  html.theme-clean #profile .pf-hero{flex-direction:column;align-items:flex-start !important;}
  html.theme-clean #profile .pf-signout{align-self:stretch;justify-content:center;}

  /* Hộp thoại và bong bóng chat vừa màn hình */
  html.theme-clean .auth-modal{width:calc(100vw - 24px) !important;max-width:none !important;}
  html.theme-clean .lsw-panel{position:fixed !important;width:auto !important;max-width:none !important;left:8px !important;right:8px !important;bottom:calc(var(--m-bottom) + 70px + env(safe-area-inset-bottom,0px)) !important;height:min(70vh,520px) !important;}

  /* Chân trang */
  html.theme-clean footer{padding:18px 14px calc(18px + 8px) !important;}
}
