html,body{overflow-x:hidden}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background:#fafafa;color:#262626;font-size:14px}
a{text-decoration:none;color:inherit}
button{cursor:pointer;border:none;background:none;font-family:inherit;font-size:inherit}
img{max-width:100%;display:block}

/* NAV */
nav.topnav{background:#fff;border-bottom:1px solid #dbdbdb;position:fixed;top:0;width:100%;z-index:100;height:54px}
.nav-inner{max-width:975px;margin:0 auto;height:100%;display:flex;align-items:center;justify-content:space-between;padding:0 20px;position:relative}
.nav-logo{font-size:22px;font-weight:600;font-style:italic;letter-spacing:-1px;white-space:nowrap}
.nav-search{position:relative;flex:1;max-width:268px;margin:0 20px}
.nav-search input{background:#efefef;border:1px solid #dbdbdb;border-radius:8px;padding:6px 12px 6px 36px;width:100%;font-size:14px;outline:none}
.nav-search input:focus{background:#fff}
.nav-search-icon{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:#8e8e8e;pointer-events:none}
.nav-icons{display:flex;align-items:center;gap:16px;flex-shrink:0}
.nav-icons a,.nav-icons button{color:#262626;display:flex;align-items:center}
.nav-icons svg{width:24px;height:24px}
.avatar-sm{width:26px;height:26px;border-radius:50%;object-fit:cover;border:1px solid #dbdbdb}
.avatar-sm-placeholder{width:26px;height:26px;border-radius:50%;background:#dbdbdb;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;color:#555}

/* MAIN LAYOUT */
.main{max-width:975px;margin:74px auto 0;padding:0 20px;display:flex;gap:32px;align-items:flex-start}
.feed-col{flex:1;min-width:0;max-width:630px}
.sidebar{width:293px;flex-shrink:0;padding-top:8px}

/* POST CARD */
.post-card{background:#fff;border:1px solid #dbdbdb;border-radius:8px;margin-bottom:24px;min-width:0}
.post-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;min-width:0}
.post-header-left{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
.post-header-left>div{min-width:0}
.avatar{width:32px;height:32px;border-radius:50%;object-fit:cover;border:1px solid #dbdbdb;flex-shrink:0}
.avatar-placeholder{width:32px;height:32px;border-radius:50%;background:#dbdbdb;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:600;color:#555;flex-shrink:0}
.avatar-lg{width:42px;height:42px;border-radius:50%;object-fit:cover;flex-shrink:0}
.avatar-lg-placeholder{width:42px;height:42px;border-radius:50%;background:#dbdbdb;display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:600;color:#555;flex-shrink:0}
.username-bold{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.post-time{font-size:12px;color:#8e8e8e}
.post-image{width:100%;display:block;object-fit:cover;max-height:600px}
.post-actions{display:flex;align-items:center;padding:8px 12px 0;gap:0}
.post-actions .right{margin-left:auto}
.action-btn{padding:8px;color:#262626;display:flex;align-items:center;justify-content:center;min-width:44px;min-height:44px}
.action-btn.liked svg path{fill:#ed4956;stroke:#ed4956}
.post-likes{padding:4px 16px;font-weight:600;font-size:14px}
.post-caption{padding:4px 16px 8px;line-height:1.5;word-break:break-word}
.post-caption .cap-user{font-weight:600;margin-right:4px}
.view-comments{padding:0 16px 4px;color:#8e8e8e;cursor:pointer;font-size:14px}
.comment-list{padding:0 16px}
.comment-item{display:flex;align-items:flex-start;gap:8px;margin-bottom:6px;font-size:14px;word-break:break-word}
.comment-item .cap-user{font-weight:600}
.comment-form{border-top:1px solid #efefef;padding:8px 16px;display:flex;align-items:center;gap:8px;margin-top:8px}
.comment-input{flex:1;border:none;outline:none;font-size:14px;background:transparent;min-width:0}
.comment-submit{color:#0095f6;font-weight:600;font-size:14px;opacity:.5;white-space:nowrap}
.comment-submit.active{opacity:1}
.post-time-sm{padding:2px 16px 12px;font-size:10px;color:#8e8e8e;text-transform:uppercase;letter-spacing:.2px}

/* STORIES */
.stories-bar{background:#fff;border:1px solid #dbdbdb;border-radius:8px;padding:14px 16px;margin-bottom:24px;display:flex;gap:16px;overflow-x:auto;-webkit-overflow-scrolling:touch}
.stories-bar::-webkit-scrollbar{height:0}
.story-item{display:flex;flex-direction:column;align-items:center;gap:6px;cursor:pointer;flex-shrink:0;-webkit-tap-highlight-color:transparent}
.story-ring{width:56px;height:56px;border-radius:50%;padding:2px;background:linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)}
.story-ring img{width:100%;height:100%;border-radius:50%;border:3px solid #fff;object-fit:cover}
.story-ring-placeholder{width:100%;height:100%;border-radius:50%;border:3px solid #fff;background:#dbdbdb;display:flex;align-items:center;justify-content:center;font-size:18px;font-weight:600}
.story-name{font-size:12px;max-width:64px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#262626}

/* EXPLORE GRID */
.explore-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:3px}
.explore-item{position:relative;aspect-ratio:1;overflow:hidden;cursor:pointer}
.explore-item img{width:100%;height:100%;object-fit:cover}
.explore-overlay{position:absolute;inset:0;background:rgba(0,0,0,.3);display:none;align-items:center;justify-content:center;gap:24px;color:#fff;font-weight:600}
.explore-item:hover .explore-overlay{display:flex}
.explore-stat{display:flex;align-items:center;gap:6px;font-size:16px}

/* PROFILE */
.profile-page{max-width:935px;margin:74px auto 0;padding:0 20px}
.profile-header{display:flex;gap:80px;padding:30px 0 44px;border-bottom:1px solid #dbdbdb;margin-bottom:16px;align-items:center}
.profile-avatar-wrap{width:150px;display:flex;justify-content:center;align-items:center;flex-shrink:0}
.profile-avatar-ring{width:158px;height:158px;border-radius:50%;padding:3px;background:linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888);flex-shrink:0}
.profile-avatar-ring-inner{width:100%;height:100%;border-radius:50%;background:#fff;padding:3px;display:flex;align-items:center;justify-content:center}
.profile-avatar{width:142px;height:142px;border-radius:50%;object-fit:cover;display:block}
.profile-avatar-placeholder{width:142px;height:142px;border-radius:50%;background:#dbdbdb;display:flex;align-items:center;justify-content:center;font-size:60px;font-weight:600;color:#555}
.profile-info{flex:1;min-width:0}
.profile-username-row{display:flex;align-items:center;gap:16px;margin-bottom:20px;flex-wrap:wrap}
.profile-username{font-size:20px;font-weight:300;word-break:break-all}
.btn{display:inline-flex;align-items:center;justify-content:center;padding:7px 16px;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;border:1px solid #dbdbdb;transition:background .1s;min-height:32px;white-space:nowrap}
.btn-primary{background:#0095f6;color:#fff;border-color:#0095f6}
.btn-primary:hover{background:#1877f2}
.btn-outline{background:#fff;color:#262626}
.btn-following{background:#efefef;color:#262626;border-color:#dbdbdb}
.profile-stats{display:flex;gap:40px;margin-bottom:20px;flex-wrap:wrap}
.stat{display:flex;flex-direction:column;align-items:center}
.stat-num{font-weight:600}
.profile-name{font-weight:600;margin-bottom:4px}
.profile-bio{white-space:pre-wrap;line-height:1.5;word-break:break-word}
.profile-website{color:#00376b;font-weight:600}
.profile-posts-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:3px}
.profile-post-item{position:relative;aspect-ratio:1;overflow:hidden}
.profile-post-item img{width:100%;height:100%;object-fit:cover}
.profile-post-overlay{position:absolute;inset:0;background:rgba(0,0,0,.3);display:none;align-items:center;justify-content:center;gap:20px;color:#fff;font-weight:600}
.profile-post-item:hover .profile-post-overlay{display:flex}

/* SIDEBAR */
.sidebar-profile{display:flex;align-items:center;gap:12px;margin-bottom:20px}
.sidebar-username{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sidebar-name{color:#8e8e8e;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.switch-account{color:#0095f6;font-weight:600;font-size:12px;margin-left:auto;white-space:nowrap}
.sidebar-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.sidebar-title span:first-child{color:#8e8e8e;font-weight:600;font-size:14px}
.sidebar-title a{color:#262626;font-weight:600;font-size:12px}
.suggest-item{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.suggest-info{flex:1;min-width:0}
.suggest-username{font-weight:600;font-size:14px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.suggest-sub{color:#8e8e8e;font-size:12px}
.follow-btn{color:#0095f6;font-weight:600;font-size:14px;white-space:nowrap}
.sidebar-footer{margin-top:24px;color:#c7c7c7;font-size:11px;line-height:1.8}

/* AUTH */
.auth-wrap{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#fafafa;padding:16px}
.auth-box{background:#fff;border:1px solid #dbdbdb;border-radius:8px;padding:40px 32px;width:100%;max-width:350px;text-align:center}
.auth-logo{font-size:36px;font-weight:600;font-style:italic;letter-spacing:-1px;margin-bottom:32px;display:block}
.form-input{width:100%;padding:9px 10px;border:1px solid #dbdbdb;border-radius:6px;background:#fafafa;font-size:12px;outline:none;margin-bottom:8px;-webkit-appearance:none}
.form-input:focus{border-color:#a8a8a8;background:#fff}
.auth-btn{width:100%;padding:10px;background:#0095f6;color:#fff;border:none;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;margin-top:4px}
.auth-divider{display:flex;align-items:center;gap:16px;margin:18px 0;color:#8e8e8e;font-size:13px;font-weight:600}
.auth-divider::before,.auth-divider::after{content:'';flex:1;border-top:1px solid #dbdbdb}
.auth-alt{background:#fff;border:1px solid #dbdbdb;border-radius:8px;padding:20px;width:100%;max-width:350px;margin-top:10px;text-align:center;font-size:14px}
.auth-alt a{color:#0095f6;font-weight:600}
.errorlist{background:#ffeaea;border:1px solid #ed4956;border-radius:6px;padding:8px 12px;margin-bottom:8px;color:#ed4956;font-size:13px;text-align:left;list-style:none}

/* UPLOAD */
.upload-wrap{max-width:600px;width:100%;margin:74px auto 0;background:#fff;border:1px solid #dbdbdb;border-radius:8px;padding:30px}
.upload-wrap h2{text-align:center;font-size:16px;font-weight:600;margin-bottom:24px;padding-bottom:12px;border-bottom:1px solid #efefef}
.upload-preview img{max-width:100%;max-height:400px;border-radius:4px;margin:0 auto}
.upload-drop{border:2px dashed #dbdbdb;border-radius:8px;padding:60px 20px;text-align:center;cursor:pointer;transition:border-color .2s}
.upload-drop-icon{font-size:48px;margin-bottom:16px}
.upload-drop p{color:#8e8e8e;font-size:14px;margin-bottom:12px}
.upload-share{background:#0095f6;color:#fff;border:none;border-radius:8px;padding:10px 24px;font-size:14px;font-weight:600;width:100%;margin-top:16px;cursor:pointer;display:block}

/* SEARCH */
.search-wrap{max-width:600px;margin:74px auto 0;padding:20px}
.search-result{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid #efefef}
.search-empty{text-align:center;color:#8e8e8e;margin-top:40px}

/* DETAIL */
.detail-card{background:#fff;border:1px solid #dbdbdb;border-radius:4px;display:flex;max-width:935px;margin:74px auto 0;min-height:0}
.detail-image{width:600px;max-height:600px;object-fit:cover;border-right:1px solid #dbdbdb;flex-shrink:0}
.detail-right{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}
.detail-right .post-header{border-bottom:1px solid #efefef}
.detail-comments{flex:1;overflow-y:auto;padding:16px;max-height:400px}
.detail-actions{border-top:1px solid #efefef;flex-shrink:0}

/* EDIT PROFILE */
.edit-wrap{max-width:700px;width:100%;margin:74px auto 0;display:flex;background:#fff;border:1px solid #dbdbdb;border-radius:4px;overflow:hidden}
.edit-sidebar-nav{width:236px;border-right:1px solid #dbdbdb;padding:20px 0;flex-shrink:0}
.edit-sidebar-nav a{display:block;padding:12px 24px;font-size:14px;font-weight:600}
.edit-sidebar-nav a.active{background:#fafafa;border-left:2px solid #262626}
.edit-content{flex:1;padding:32px 40px;min-width:0}
.edit-row{display:flex;margin-bottom:20px;align-items:flex-start}
.edit-label{width:180px;font-weight:600;text-align:right;padding-right:32px;padding-top:8px;font-size:14px;flex-shrink:0}
.edit-field{flex:1;min-width:0}
.edit-field input,.edit-field textarea{width:100%;padding:8px;border:1px solid #dbdbdb;border-radius:4px;font-size:14px;outline:none}
.edit-save{background:#0095f6;color:#fff;border:none;border-radius:4px;padding:7px 16px;font-size:14px;font-weight:600;cursor:pointer}

/* MSGS */
.msg{padding:8px 16px;margin:8px 0;border-radius:4px;font-size:14px}
.msg-success{background:#d4edda;color:#155724;border:1px solid #c3e6cb}
.msg-error{background:#f8d7da;color:#721c24;border:1px solid #f5c6cb}

/* SITE FOOTER */
.site-footer{text-align:center;color:#c7c7c7;font-size:11px;line-height:1.8;padding:24px 0 40px}

/* BOTTOM NAV - hidden on desktop */
.bottom-nav{display:none}

/* MOBILE */
@media (max-width: 768px) {
  body{padding-bottom:50px}
  .nav-search{display:none}
  .nav-inner{padding:0 12px}
  .nav-logo{font-size:20px}
  .main{width:100%;max-width:100%;margin:54px 0 0;padding:0;flex-direction:column;gap:0}
  .feed-col{width:100%;max-width:100%;min-width:0}
  .sidebar{display:none}
  .profile-page{width:100%;max-width:100%;margin:54px 0 0;padding:0}
  .stories-bar{border-radius:0;border-left:none;border-right:none;margin-bottom:0;padding:10px 8px}
  .post-card{border-radius:0;border-left:none;border-right:none;margin-bottom:0;border-bottom:6px solid #efefef;width:100%}
  .profile-header{gap:16px;padding:16px;margin-bottom:4px}
  .profile-avatar-wrap{width:82px}
  .profile-avatar-ring{width:82px;height:82px;padding:2px}
  .profile-avatar-ring-inner{padding:2px}
  .profile-avatar{width:72px;height:72px}
  .profile-avatar-placeholder{width:72px;height:72px;font-size:30px}
  .profile-info{overflow:hidden}
  .profile-username-row{gap:8px;margin-bottom:12px}
  .profile-username{font-size:16px}
  .profile-stats{gap:0;justify-content:space-around;flex-wrap:nowrap;margin-bottom:12px}
  .stat{flex:1;align-items:center}
  .btn{font-size:13px;padding:6px 12px}
  .profile-posts-grid{gap:2px}
  .detail-card{flex-direction:column;margin:54px 0 0;border-radius:0;border-left:none;border-right:none;max-width:100%;width:100%}
  .detail-image{width:100%;max-height:none;border-right:none;border-bottom:1px solid #efefef}
  .detail-comments{max-height:250px}
  .edit-wrap{flex-direction:column;margin:54px 0 0;max-width:100%;border-radius:0;border:none}
  .edit-sidebar-nav{width:100%;border-right:none;border-bottom:1px solid #dbdbdb;padding:0;display:flex;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .edit-sidebar-nav::-webkit-scrollbar{height:0}
  .edit-sidebar-nav a{white-space:nowrap;border-left:none !important;border-bottom:2px solid transparent;padding:12px 16px}
  .edit-sidebar-nav a.active{border-bottom-color:#262626;background:none}
  .edit-content{padding:16px}
  .edit-row{flex-direction:column;margin-bottom:16px}
  .edit-label{width:100%;text-align:left;padding:0 0 6px;font-size:13px}
  .upload-wrap{margin:54px 0 0;max-width:100%;width:100%;border-radius:0;border-left:none;border-right:none;padding:16px}
  .upload-drop{padding:40px 16px}
  .search-wrap{margin:54px 0 0;padding:12px 16px}
  .bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;background:#fff;border-top:1px solid #dbdbdb;z-index:100;height:50px;align-items:center;justify-content:space-around}
  .bottom-nav a{display:flex;align-items:center;justify-content:center;flex:1;height:100%;color:#262626;-webkit-tap-highlight-color:transparent}
  .bottom-nav svg{width:26px;height:26px}
  .bnav-avatar{width:26px;height:26px;border-radius:50%;object-fit:cover;border:2px solid #262626}
  .bnav-avatar-placeholder{width:26px;height:26px;border-radius:50%;background:#dbdbdb;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600}
  .explore-grid{gap:2px}
  .site-footer{padding-bottom:60px}
}
